WP_Theme_JSON::get_block_element_selectors
Generates all the element selectors for a block.
Метод класса: WP_Theme_JSON{}
Хуков нет.
Возвращает
Массив. The block's element selectors.
Использование
$result = WP_Theme_JSON::get_block_element_selectors( $root_selector );
- $root_selector(строка) (обязательный)
- The block's root CSS selector.
Список изменений
| С версии 6.3.0 | Введена. |
Код WP_Theme_JSON::get_block_element_selectors() WP Theme JSON::get block element selectors WP 7.0
protected static function get_block_element_selectors( $root_selector ) {
/*
* Assign defaults, then override those that the block sets by itself.
* If the block selector is compounded, will append the element to each
* individual block selector.
*/
$block_selectors = explode( ',', $root_selector );
$element_selectors = array();
foreach ( static::ELEMENTS as $el_name => $el_selector ) {
$element_selector = array();
foreach ( $block_selectors as $selector ) {
if ( $selector === $el_selector ) {
$element_selector = array( $el_selector );
break;
}
$element_selector[] = static::prepend_to_selector( $el_selector, $selector . ' ' );
}
$element_selectors[ $el_name ] = implode( ',', $element_selector );
}
return $element_selectors;
}