block_core_gallery_render_context() │ WP 7.0.0

Adds a unique ID to the gallery block context.

Хуков нет.

Возвращает

array. Filtered context.

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

block_core_gallery_render_context( $context, $parsed_block );
$context(массив) (обязательный)
Default context.
$parsed_block(массив) (обязательный)
Block being rendered, filtered by render_block_data.

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

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

Код block_core_gallery_render_context() WP 7.1.3

function block_core_gallery_render_context( $context, $parsed_block ) {
	if ( 'core/gallery' === $parsed_block['blockName'] ) {
		$context['galleryId'] = uniqid();
	}
	return $context;
}