WP_Block_Patterns_Registry::get_all_registered()publicWP 5.5.0

Retrieves all registered block patterns.

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

Хуков нет.

Возвращает

Массив[]. Array of arrays containing the registered block patterns properties, and per style.

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

$WP_Block_Patterns_Registry = new WP_Block_Patterns_Registry();
$WP_Block_Patterns_Registry->get_all_registered( $outside_init_only );
$outside_init_only(true|false)
Return only patterns registered outside the init action.
По умолчанию: false

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

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

Код WP_Block_Patterns_Registry::get_all_registered() WP 6.5.2

public function get_all_registered( $outside_init_only = false ) {
	$patterns      = $outside_init_only
			? $this->registered_patterns_outside_init
			: $this->registered_patterns;
	$hooked_blocks = get_hooked_blocks();

	foreach ( $patterns as $index => $pattern ) {
		$pattern['content']            = $this->get_content( $pattern['name'], $outside_init_only );
		$patterns[ $index ]['content'] = $this->prepare_content( $pattern, $hooked_blocks );
	}

	return array_values( $patterns );
}