wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



get_block_editor_settings › WordPress Function

Seit5.8.0
Veraltetn/v
get_block_editor_settings ( $editor_name, $custom_settings = array() )
Parameter: (2)
  • (string) $editor_name The name of the editor (e.g. 'post-editor').
    Erforderlich: Ja
  • (array) $custom_settings Optional custom settings to use with the editor type.
    Erforderlich: Nein
    Standard: array()
Gibt zurück:
  • (array) The contextualized block editor settings.
Definiert in:
Codex:

Returns the contextualized block editor settings settings for a selected editor type.



Quellcode

function get_block_editor_settings( $editor_name, $custom_settings = array() ) {
	$editor_settings = array_merge(
		get_default_block_editor_settings( $editor_name ),
		array(
			'allowedBlockTypes' => get_allowed_block_types( $editor_name ),
			'blockCategories'   => get_block_categories( $editor_name ),
		),
		$custom_settings
	);

	/**
	 * Filters the settings to pass to the block editor for all editor type.
	 *
	 * @since 5.8.0
	 *
	 * @param array  $editor_settings Default editor settings.
	 * @param string $editor_name     The name of the editor, e.g. 'post-editor'.
	 */
	$editor_settings = apply_filters( 'block_editor_settings_all', $editor_settings, $editor_name );

	/**
	 * Filters the settings to pass to the block editor for a given editor type.
	 *
	 * The dynamic portion of the hook name, `$editor_name`, refers to the name
	 * of the editor type, e.g. 'post-editor', 'site-editor', etc.
	 *
	 * @since 5.8.0
	 *
	 * @param array  $editor_settings Default editor settings.
	 * @param string $editor_name     The name of the editor, e.g. 'post-editor'.
	 */
	$editor_settings = apply_filters( "block_editor_settings_{$editor_name}", $editor_settings, $editor_name );
	if ( 'post-editor' === $editor_name ) {
		$post = get_post();

		/**
		 * Filters the settings to pass to the block editor.
		 *
		 * @since 5.0.0
		 * @deprecated 5.8.0 The hook transitioned to support also screens that don't contain $post instance.
		 *
		 * @param array   $editor_settings Default editor settings.
		 * @param WP_Post $post            Post being edited.
		 */
		$editor_settings = apply_filters_deprecated( 'block_editor_settings', array( $editor_settings, $post ), '5.8.0', 'block_editor_settings_all' );
	}

	return $editor_settings;
}