handlers[] = new Handler\Friends_Message(); $this->handlers[] = new Handler\Friends_Status_Post(); } /** * Get the instantiated handler class for the specified type, or null if it isn't configured or known. * * @param 'Comments'|'bbPress'|'BuddyPress' $which The handler type. * @return Handler\Handler|null object or null it not configured. */ public function get_handler( $which ) { if ( isset( $this->handlers[ $which ] ) ) { return $this->handlers[ $which ]; } return null; } /** * Perform additional admin tasks when on the comment page * * @param String $hook Page hook. * @return void */ public function admin_enqueue_scripts( $hook ) { foreach ( $this->handlers as $handler ) { if ( $handler->can_show_admin_editor( $hook ) ) { add_action( 'admin_head', function() use ( $handler ) { add_filter( 'the_editor', [ $handler, 'the_editor' ] ); add_filter( 'wp_editor_settings', [ $handler, 'wp_editor_settings' ], 10, 2 ); } ); // Stops a problem with the Gutenberg plugin accessing widgets that don't exist remove_action( 'admin_footer', 'gutenberg_block_editor_admin_footer' ); // Load Gutenberg in in_admin_header so WP admin doesn't set the 'block-editor-page' body class add_action( 'in_admin_header', function() use ( $handler ) { $handler->load_editor( '.wp-editor-area' ); } ); break; } } } } Blocks_Everywhere::init();