WP_Block_Type::get_variations()publicWP 6.5.0

Get block variations.

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

Хуки из метода

Возвращает

Массив[].

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

$WP_Block_Type = new WP_Block_Type();
$WP_Block_Type->get_variations();

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

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

Код WP_Block_Type::get_variations() WP 6.8

public function get_variations() {
	if ( ! isset( $this->variations ) ) {
		$this->variations = array();
		if ( is_callable( $this->variation_callback ) ) {
			$this->variations = call_user_func( $this->variation_callback );
		}
	}

	/**
	 * Filters the registered variations for a block type.
	 *
	 * @since 6.5.0
	 *
	 * @param array         $variations Array of registered variations for a block type.
	 * @param WP_Block_Type $block_type The full block type object.
	 */
	return apply_filters( 'get_block_type_variations', $this->variations, $this );
}