diff --git a/src/Wordpress/ACF.php b/src/Wordpress/ACF.php index e10378c..ccbe468 100644 --- a/src/Wordpress/ACF.php +++ b/src/Wordpress/ACF.php @@ -17,6 +17,7 @@ public function __construct() add_action('after_setup_theme', [$this, 'setupOptionsPage']); add_action('acf/init', [$this, 'registerGoogleMapsKey']); add_filter('allowed_block_types', [$this, 'allowedBlocks']); + add_action('admin_menu', [$this, 'reusableBlocksMenu']); // add action for logged-in users add_action( "wp_ajax_acf/ajax/check_screen", [$this, 'allowedBlocks'], 1); @@ -94,6 +95,7 @@ public function allowedBlocks($allowed_block_types) $blocks = acf_get_block_types(); $allowed = [ + 'core/block', 'gravityforms/block' ]; @@ -105,4 +107,12 @@ public function allowedBlocks($allowed_block_types) return $allowed; } + + /** + * Adds "Reusable Blocks" menu to admin + */ + public static function reusableBlocksMenu() + { + add_menu_page('Reusable Blocks', 'Reusable Blocks', 'edit_posts', 'edit.php?post_type=wp_block', '', 'dashicons-editor-table', 22); + } }