ACF_Form_Gutenberg::filter_block_editor_meta_boxes()publicACF 5.7.14

filter_block_editor_meta_boxes

description

Метод класса: ACF_Form_Gutenberg{}

Хуков нет.

Возвращает

type. Description.

Использование

$ACF_Form_Gutenberg = new ACF_Form_Gutenberg();
$ACF_Form_Gutenberg->filter_block_editor_meta_boxes( $wp_meta_boxes );
$wp_meta_boxes (обязательный)
-

Список изменений

С версии 5.7.14 Введена.

Код ACF_Form_Gutenberg::filter_block_editor_meta_boxes() ACF 6.0.4

function filter_block_editor_meta_boxes( $wp_meta_boxes ) {

	// Globals
	global $current_screen;

	// Move 'acf_after_title' metaboxes into 'normal' location.
	if ( isset( $wp_meta_boxes[ $current_screen->id ]['acf_after_title'] ) ) {

		// Extract locations.
		$locations = $wp_meta_boxes[ $current_screen->id ];

		// Ensure normal location exists.
		if ( ! isset( $locations['normal'] ) ) {
			$locations['normal'] = array();
		}
		if ( ! isset( $locations['normal']['high'] ) ) {
			$locations['normal']['high'] = array();
		}

		// Append metaboxes.
		foreach ( $locations['acf_after_title'] as $priority => $meta_boxes ) {
			$locations['normal']['high'] = array_merge( $meta_boxes, $locations['normal']['high'] );
		}

		// Update original data.
		$wp_meta_boxes[ $current_screen->id ] = $locations;
		unset( $wp_meta_boxes[ $current_screen->id ]['acf_after_title'] );

		// Avoid conflicts with saved metabox order.
		add_filter( 'get_user_option_meta-box-order_' . $current_screen->id, array( $this, 'modify_user_option_meta_box_order' ) );
	}

	// Return
	return $wp_meta_boxes;
}