WP_Theme_JSON::get_block_classes()
Converts each style section into a list of rulesets containing the block styles to be appended to the stylesheet.
See glossary at https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax
For each section this creates a new ruleset such as:
block-selector {
style-property-one: value;
}
Метод класса: WP_Theme_JSON{}
Хуков нет.
Возвращает
Строку
. The new stylesheet.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_block_classes( $style_nodes );
- $style_nodes(массив) (обязательный)
- Nodes with styles.
Список изменений
С версии 5.8.0 | Введена. |
С версии 5.8.0 | As get_block_styles(). |
С версии 5.9.0 | Renamed from get_block_styles() to get_block_classes() and no longer returns preset classes. Removed the $setting_nodes parameter. |
С версии 6.1.0 | Moved most internal logic to get_styles_for_block(). |
Код WP_Theme_JSON::get_block_classes() WP Theme JSON::get block classes WP 6.5.2
protected function get_block_classes( $style_nodes ) { $block_rules = ''; foreach ( $style_nodes as $metadata ) { if ( null === $metadata['selector'] ) { continue; } $block_rules .= static::get_styles_for_block( $metadata ); } return $block_rules; }