wp_apply_dimensions_support()WP 5.9.0

Adds CSS classes for block dimensions to the incoming attributes array. This will be applied to the block markup in the front-end.

Хуков нет.

Возвращает

Массив. Block dimensions CSS classes and inline styles.

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

wp_apply_dimensions_support( $block_type, $block_attributes ) // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable;
$block_type(WP_Block_Type) (обязательный)
Block Type.
$block_attributes(массив) (обязательный)
Block attributes.

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

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

Код wp_apply_dimensions_support() WP 6.0

function wp_apply_dimensions_support( $block_type, $block_attributes ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
	if ( wp_should_skip_block_supports_serialization( $block_type, '__experimentalDimensions' ) ) {
		return array();
	}

	$styles = array();

	// Height support to be added in near future.
	// Width support to be added in near future.

	return empty( $styles ) ? array() : array( 'style' => implode( ' ', $styles ) );
}