ACF\Pro\AI\GEO\Outputs

Blocks::add_block_json_auto_jsonld_supportpublicACF 6.8.0

Add support for autoJsonLd property from block.json ACF namespace

Maps the 'autoJsonLd' property from block.json's acf namespace to 'auto_jsonld' setting. Also maps 'schemaType' to 'schema_type' for custom Schema.org @type values. This runs after ACF's own block.json handler.

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

Хуков нет.

Возвращает

array. Modified block settings.

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

$Blocks = new Blocks();
$Blocks->add_block_json_auto_jsonld_support( $settings, $metadata );
$settings(массив) (обязательный)
The compiled block settings.
$metadata(массив) (обязательный)
The raw json metadata.

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

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

Код Blocks::add_block_json_auto_jsonld_support() ACF 6.8.8

public function add_block_json_auto_jsonld_support( $settings, $metadata ) {
	// Only process ACF blocks.
	if ( ! isset( $metadata['acf'] ) || ! is_array( $metadata['acf'] ) ) {
		return $settings;
	}

	// Map autoJsonLd from ACF namespace to auto_jsonld.
	if ( isset( $metadata['acf']['autoJsonLd'] ) ) {
		$settings['auto_jsonld'] = $metadata['acf']['autoJsonLd'];
	}

	// Map schemaType from ACF namespace to schema_type.
	if ( isset( $metadata['acf']['schemaType'] ) ) {
		$settings['schema_type'] = $metadata['acf']['schemaType'];
	}

	return $settings;
}