wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_render_elements_support_styles is private and should not be used in themes or plugins directly.
wp_render_elements_support_styles › WordPress Function
Seit6.0.0
Veraltetn/v
› wp_render_elements_support_styles ( $pre_render, $block )
Zugriff: |
|
Parameter: (2) |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: | |
Changelog: |
|
Renders the elements stylesheet.
In the case of nested blocks we want the parent element styles to be rendered before their descendants. This solves the issue of an element (e.g.: link color) being styled in both the parent and a descendant: we want the descendant style to take priority, and this is done by loading it after, in DOM order.Quellcode
function wp_render_elements_support_styles( $pre_render, $block ) { $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] ); $element_block_styles = isset( $block['attrs']['style']['elements'] ) ? $block['attrs']['style']['elements'] : null; /* * For now we only care about link color. */ $skip_link_color_serialization = wp_should_skip_block_supports_serialization( $block_type, 'color', 'link' ); if ( $skip_link_color_serialization ) { return null; } $class_name = wp_get_elements_class_name( $block ); $link_block_styles = isset( $element_block_styles['link'] ) ? $element_block_styles['link'] : null; wp_style_engine_get_styles( $link_block_styles, array( 'selector' => ".$class_name a", 'context' => 'block-supports', ) ); return null; }