Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle figuren-theater/theater-production-blocks (0.1.0) #11

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"inc/"
],
"files": [
"inc/production-blocks/namespace.php",
"inc/label-printing/namespace.php",
"inc/namespace.php"
]
Expand All @@ -62,7 +63,8 @@
"extra": {
"altis": {
"install-overrides": [
"figuren-theater/label-printing"
"figuren-theater/label-printing",
"figuren-theater/theater-production-blocks"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ function bootstrap() :void {
* @example NameSpace\bootstrap();
*/
Label_Printing\bootstrap();
Production_Blocks\bootstrap();
}
62 changes: 62 additions & 0 deletions inc/production-blocks/namespace.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
/**
* Figuren_Theater Theater Production_Blocks.
*
* @package figuren-theater/ft-theater
*/

namespace Figuren_Theater\Theater\Production_Blocks;

use Figuren_Theater;

Check warning on line 10 in inc/production-blocks/namespace.php

View workflow job for this annotation

GitHub Actions / call-workflow-build-test-measure / Lint: PHP

Unused use statement

use FT_VENDOR_DIR;

use function add_action;
use function add_filter;
use function is_network_admin;
use function is_user_admin;

const BASENAME = 'theater-production-blocks/plugin.php';
const PLUGINPATH = '/figuren-theater/' . BASENAME;
// const PLUGINPATH = '/wpackagist-plugin/' . BASENAME; // Not yet.

/**
* Bootstrap module, when enabled.
*
* @return void
*/
function bootstrap() :void {
add_action( 'init', __NAMESPACE__ . '\\load_plugin', -1 );
}

/**
* Conditionally load the plugin itself and its modifications.
*
* @return void
*/
function load_plugin() :void {

// Do only load in "normal" admin view & public views.
// Not for:
// - network-admin views
// - user-admin views.
if ( is_network_admin() || is_user_admin() ) {
return;
}

require_once FT_VENDOR_DIR . PLUGINPATH; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant

add_filter(
'wpt-production-posttype',
function () : string {
return 'ft_production';
}
);

add_filter(
'wpt-production-shadow-taxonomy',
function () : string {
return 'ft_production_shadow';
}
);
}