Automattic\WooCommerce\Admin\Features\ProductBlockEditor

BlockRegistry::augment_attributesprivateWC 1.0

Augment the attributes of a block by adding attributes that are used by the product editor.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->augment_attributes( $attributes );
$attributes(массив) (обязательный)
Block attributes.

Код BlockRegistry::augment_attributes() WC 10.7.0

private function augment_attributes( $attributes ) {
	global $wp_version;
	// Note: If you modify this function, also update the client-side
	// registerWooBlockType function in @woocommerce/block-templates.
	$augmented_attributes = array_merge(
		$attributes,
		array(
			'_templateBlockId'                => array(
				'type' => 'string',
				'role' => 'content',
			),
			'_templateBlockOrder'             => array(
				'type' => 'integer',
				'role' => 'content',
			),
			'_templateBlockHideConditions'    => array(
				'type' => 'array',
				'role' => 'content',
			),
			'_templateBlockDisableConditions' => array(
				'type' => 'array',
				'role' => 'content',
			),
			'disabled'                        => isset( $attributes['disabled'] ) ? $attributes['disabled'] : array(
				'type' => 'boolean',
				'role' => 'content',
			),
		)
	);
	if ( ! $this->has_role_support() ) {
		foreach ( $augmented_attributes as $key => $attribute ) {
			if ( isset( $attribute['role'] ) ) {
				$augmented_attributes[ $key ]['__experimentalRole'] = $attribute['role'];
			}
		}
	}
	return $augmented_attributes;
}