id === 'widgets' ) { $dependencies[] = 'wp-edit-widgets'; } else { $dependencies[] = 'wp-edit-post'; } } else { $dependencies[] = 'wp-edit-post'; } wp_enqueue_script( 'block-manager', plugins_url( 'build/block-manager.js', __FILE__ ), $dependencies, BLOCK_MANAGER_VERSION, false ); wp_localize_script( 'block-manager', 'gutenberg_block_manager', [ 'blocks' => GBM_Blocks::gbm_get_all_disabled_blocks(), 'categories' => GBM_Categories::gbm_get_all_block_categories(), 'patterns' => GBM_Patterns::gbm_get_all_disabled_patterns(), ] ); } /** * Confirm user has access to Block Manager. * * @author ConnektMedia * @since 1.1 * @return Boolean */ public static function has_access() { $access = false; if ( is_user_logged_in() && current_user_can( apply_filters( 'block_manager_user_role', 'activate_plugins' ) ) ) { $access = true; } return $access; } } /** * The main function for Gutenberg_Block_Manager_Init * * @author ConnektMedia * @since 1.0 */ function gbm_init() { include_once ABSPATH . 'wp-admin/includes/plugin.php'; if ( is_plugin_active( 'gutenberg/gutenberg.php' ) || version_compare( get_bloginfo( 'version' ), '4.9.9', '>' ) ) { Gutenberg_Block_Manager::instance(); } } add_action( 'plugins_loaded', 'gbm_init', 100 );