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

Fix | Move 'Image Source Control' from ft-media to ft-site-editing pa… #8

Merged
merged 9 commits into from
Mar 5, 2023
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Thoose are completely managed by code and lack of their typical UI.

* [Abbreviation Button for the Block Editor](https://wordpress.org/plugins/abbreviation-button-for-the-block-editor/#developers)
* [Copyright Block](https://wordpress.org/plugins/copyright-block/#developers)
* [Block Catalog](https://wordpress.org/plugins/block-catalog/#developers)
* [Block Visibility](https://wordpress.org/plugins/block-visibility/#developers)
Conditional Visibility Control for the Block Editor
* [Dinosaur Game](https://wordpress.org/plugins/dinosaur-game/#developers)
Expand Down
11 changes: 11 additions & 0 deletions assets/image-source-control-isc/fix.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* remove ugly scroll-bars */
.isc_all_image_list_box {
overflow: unset !important;
}
.isc_all_image_list_box th {
text-align: left;
}
/* hide column with attachment-ID */
.isc_all_image_list_box tr > :first-child {
display: none;
}
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"autoload": {
"files": [
"inc/abbreviation-button-for-the-block-editor/namespace.php",
"inc/block-catalog/namespace.php",
"inc/block-visibility/namespace.php",
"inc/cbstdsys-post-subtitle/namespace.php",
"inc/copyright-block/namespace.php",
Expand Down Expand Up @@ -74,8 +75,9 @@
"figuren-theater/ft-options": "^1.1",
"figuren-theater/ft-network-block-editor": "*",
"figuren-theater/ft-network-block-patterns": "^1.0",
"carstingaxion/cbstdsys-post-subtitle": "dev-master",
"carstingaxion/cbstdsys-post-subtitle": "0.1.1",
"wpackagist-plugin/abbreviation-button-for-the-block-editor":"^0.1",
"wpackagist-plugin/block-catalog":"^1.4",
"wpackagist-plugin/block-visibility":"^2",
"wpackagist-plugin/copyright-block": "^0.1",
"wpackagist-plugin/dinosaur-game": "^1.0",
Expand All @@ -97,6 +99,7 @@
"figuren-theater/ft-network-block-patterns",
"carstingaxion/cbstdsys-post-subtitle",
"wpackagist-plugin/abbreviation-button-for-the-block-editor",
"wpackagist-plugin/block-catalog",
"wpackagist-plugin/block-visibility",
"wpackagist-plugin/copyright-block",
"wpackagist-plugin/dinosaur-game",
Expand All @@ -119,6 +122,6 @@
}
},
"require-dev": {
"wpackagist-plugin/gutenberg": ">=15.1"
"wpackagist-plugin/gutenberg": ">=15.2"
}
}
55 changes: 35 additions & 20 deletions composer.lock

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

46 changes: 46 additions & 0 deletions inc/block-catalog/namespace.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
/**
* Figuren_Theater Site_Editing Block_Catalog.
*
* @package figuren-theater/site_editing/block_catalog
*/

namespace Figuren_Theater\Site_Editing\Block_Catalog;

use FT_VENDOR_DIR;

use Figuren_Theater;
use function Figuren_Theater\get_config;

use function add_action;
use function is_admin;
use function is_network_admin;
use function is_user_admin;

const BASENAME = 'block-catalog/block-catalog.php';
const PLUGINPATH = FT_VENDOR_DIR . '/wpackagist-plugin/' . BASENAME;

/**
* Bootstrap module, when enabled.
*/
function bootstrap() {

add_action( 'init', __NAMESPACE__ . '\\load_plugin', 9 );
}

function load_plugin() {

$config = Figuren_Theater\get_config()['modules']['site_editing'];
if ( ! $config['block-catalog'] )
return; // early

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

require_once PLUGINPATH;
}
19 changes: 16 additions & 3 deletions inc/block-visibility/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
use function Figuren_Theater\get_config;

use function add_action;
use function is_admin;
use function current_user_can;
use function is_network_admin;
use function is_user_admin;
use function remove_action;

const BASENAME = 'block-visibility/block-visibility.php';
const PLUGINPATH = FT_VENDOR_DIR . '/wpackagist-plugin/' . BASENAME;
Expand All @@ -35,12 +36,24 @@ function load_plugin() {
return; // early

// Do only load in "normal" admin view
// and public views
// Not for:
// - public views
// - network-admin views
// - user-admin views
if ( ! is_admin() || is_network_admin() || is_user_admin() )
if ( is_network_admin() || is_user_admin() )
return;

require_once PLUGINPATH;

// 'plugins_loaded' is too early for 'current_user_can()'
// add_action( 'plugins_loaded', __NAMESPACE__ . '\\post_load_plugin', 11 );
add_action( 'admin_menu', __NAMESPACE__ . '\\post_load_plugin', 0 );

}

function post_load_plugin() {
if ( current_user_can( 'manage_sites' ) ) {
return;
}
remove_action( 'admin_menu', 'BlockVisibility\\Admin\\add_settings_page' );
}
Loading