Skip to content

Commit

Permalink
Merge pull request #22 from dcooney/hotfix/not-working-edit-screens
Browse files Browse the repository at this point in the history
Edit screen hotfix
  • Loading branch information
dcooney committed Nov 30, 2022
2 parents 815b275 + c08822d commit 13bc9c3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
5 changes: 4 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Tested up to: 6.1
License: GPLv2 or later
Stable tag: trunk
Homepage: https://connekthq.com/
Version: 1.2.3
Version: 1.2.4

Gutenberg Block Manager by [Connekt](https://connekthq.com) will allow you to manage the activation status of Gutenberg blocks and remove unwanted blocks from the WordPress post editor.

Expand Down Expand Up @@ -68,6 +68,9 @@ Then navigate to `wp-admin -> Settings -> Block Manager` to use the plugin.

== Changelog ==

= 1.2.4 - November 30, 2022 =
* HOTFIX - Fixed issue with plugin not working on `edit` screens.

= 1.2.3 - November 19, 2022 =
* FIX: Added fix for blank screen when users have JetPack plugin enabled.
* FIX: Fixed issue with missing semi-colon in Block Manager export functionality.
Expand Down
47 changes: 26 additions & 21 deletions block-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Text Domain: block-manager
* Author: Darren Cooney
* Author URI: https://connekthq.com
* Version: 1.2.3
* Version: 1.2.4
* License: GPL
* Copyright: Darren Cooney & Connekt Media
*
Expand All @@ -18,8 +18,8 @@
exit;
}

define( 'BLOCK_MANAGER_VERSION', '1.2.3' );
define( 'BLOCK_MANAGER_RELEASE', 'November 19, 2022' );
define( 'BLOCK_MANAGER_VERSION', '1.2.4' );
define( 'BLOCK_MANAGER_RELEASE', 'November 30, 2022' );
define( 'BLOCK_MANAGER_DIR_PATH', plugin_dir_path( __FILE__ ) );
define( 'BLOCK_MANAGER_OPTION', 'gbm_disabled_blocks' );
define( 'BLOCK_MANAGER_CATEGORIES', 'gbm_categories' );
Expand Down Expand Up @@ -83,25 +83,30 @@ private function __construct() {
*/
public function gbm_enqueue() {
$screen = get_current_screen();
if ( $screen->action === 'add' || $screen->action === 'edit' ) {
wp_enqueue_script(
'block-manager',
plugins_url( 'dist/js/gbm.js', __FILE__ ),
array( 'wp-edit-post' ),
BLOCK_MANAGER_VERSION,
false
);
wp_localize_script(
'block-manager',
'gutenberg_block_manager',
$this->gbm_get_disabled_blocks()
);
wp_localize_script(
'block-manager',
'gutenberg_block_manager_categories',
$this->gbm_get_filtered_cats()
);
// Don't load Block Manager on Widget screen.
if ( $screen->id === 'widgets' ) {
// Note: GBM throws an error around `_wpLoadBlockEditor` being not available on the screen.
// TODO: Investigate how the widgets screen loads the block editor.
return;
}

wp_enqueue_script(
'block-manager',
plugins_url( 'dist/js/gbm.js', __FILE__ ),
array( 'wp-edit-post' ),
BLOCK_MANAGER_VERSION,
false
);
wp_localize_script(
'block-manager',
'gutenberg_block_manager',
$this->gbm_get_disabled_blocks()
);
wp_localize_script(
'block-manager',
'gutenberg_block_manager_categories',
$this->gbm_get_filtered_cats()
);
}

/**
Expand Down
1 change: 0 additions & 1 deletion class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public function __construct() {
* @return null
*/
public function gbm_admin_enqueue( $hook ) {

if ( 'settings_page_block-manager' !== $hook ) {
return;
}
Expand Down

0 comments on commit 13bc9c3

Please sign in to comment.