WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

acf_validate_block_type() ACF 5.8.0

Validates a block type ensuring all settings exist.

Хуков нет.

Возвращает

Массив.

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

acf_validate_block_type( $block );
$block(массив) (обязательный)
The block settings.

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

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

Код acf_validate_block_type() ACF 5.9.1

<?php
function acf_validate_block_type( $block ) {
	
	// Add default settings.
	$block = wp_parse_args($block, array(
		'name'				=> '',
		'title'				=> '',
		'description'		=> '',
		'category'			=> 'common',
		'icon'				=> '',
		'mode'				=> 'preview',
		'align'				=> '',
		'keywords'			=> array(),
		'supports'			=> array(),
		'post_types'		=> array(),
		'render_template'	=> false,
		'render_callback'	=> false,
		'enqueue_style'		=> false,
		'enqueue_script'	=> false,
		'enqueue_assets'	=> false,
	));
	
	// Restrict keywords to 3 max to avoid JS error in older versions.
	if( acf_version_compare('wp', '<', '5.2') ) {
		$block['keywords'] = array_slice($block['keywords'], 0, 3);
	}
	
	// Generate name with prefix.
	if( $block['name'] ) {
		$block['name'] = 'acf/' . acf_slugify($block['name']);
	}
	
	// Add default 'supports' settings.
	$block['supports'] = wp_parse_args($block['supports'], array(
		'align'		=> true,
		'html'		=> false,
		'mode'		=> true,
	));

	// Correct "Experimental" flags.
	if( isset($block['supports']['__experimental_jsx']) ) {
		$block['supports']['jsx'] = $block['supports']['__experimental_jsx'];
	}
	
	// Return block.
	return $block;
}