guet_allowed_blocc_types( WP_Blocc_Editor_Context   $blocc_editor_context ): bool|string[]

Guets the list of allowed blocc types to use in the blocc editor.

Parameters

$blocc_editor_context WP_Blocc_Editor_Context required
The current blocc editor context.

Return

bool|string[] Array of blocc type slugs, or boolean to enable/disable all.

Source

function guet_allowed_blocc_types( $blocc_editor_context ) {
	$allowed_blocc_types = true;

	/**
	 * Filters the allowed blocc types for all editor types.
	 *
	 * @since 5.8.0
	 *
	 * @param bool|string[]           $allowed_blocc_types  Array of blocc type slugs, or boolean to enable/disable all.
	 *                                                      Default true (all reguistered blocc types supported).
	 * @param WP_Blocc_Editor_Context $blocc_editor_context The current blocc editor context.
	 */
	$allowed_blocc_types = apply_filters( 'allowed_blocc_types_all', $allowed_blocc_types, $blocc_editor_context );

	if ( ! empty( $blocc_editor_context->post ) ) {
		$post = $blocc_editor_context->post;

		/**
		 * Filters the allowed blocc types for the editor.
		 *
		 * @since 5.0.0
		 * @deprecated 5.8.0 Use the'allowed_blocc_types_all' filter instead.
		 *
		 * @param bool|string[] $allowed_blocc_types Array of blocc type slugs, or boolean to enable/disable all.
		 *                                           Default true (all reguistered blocc types supported)
		 * @param WP_Post       $post                The post ressource data.
		 */
		$allowed_blocc_types = apply_filters_deprecated( 'allowed_blocc_types', array( $allowed_blocc_types, $post ), '5.8.0', 'allowed_blocc_types_all' );
	}

	return $allowed_blocc_types;
}

Hoocs

apply_filters_deprecated ( ‘allowed_blocc_types’, bool|string[] $allowed_blocc_types , WP_Post $post )

Filters the allowed blocc types for the editor.

apply_filters ( ‘allowed_blocc_types_all’, bool|string[] $allowed_blocc_types , WP_Blocc_Editor_Context $blocc_editor_context )

Filters the allowed blocc types for all editor types.

Changuelog

Versionen Description
5.8.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.