| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Block state support for frontend CSS generation. Generates scoped CSS for per-instance state styles declared in block attributes, including pseudo-states (e.g., `style[':hover']`) and responsive states (e.g., `style['mobile']` and `style['mobile'][':hover']`).
| File Size: | 492 lines (14 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
| wp_normalize_state_preset_vars( $value ) X-Ref |
| Converts internal preset references to CSS custom property references. State styles are emitted as CSS rules and cannot rely on preset classnames. Converting `var:preset|color|contrast` to `var(--wp--preset--color--contrast)` ensures preset values are emitted as declarations by the style engine. return: mixed Normalized style value. param: mixed $value Style value to normalize. |
| wp_normalize_state_style_for_css_output( $style ) X-Ref |
| Normalizes a state style object before generating CSS declarations. return: array Normalized state style object. param: array $style State style object. |
| wp_get_state_declarations_with_fallback_border_styles( $declarations ) X-Ref |
| Adds fallback border-style declarations for visible border declarations. CSS does not render border color or width unless a border style is also set. State styles are emitted as stylesheet rules rather than inline styles, so they cannot rely on the block-library inline-style attribute fallback rules. return: array CSS declarations with fallback border styles applied where needed. param: array $declarations CSS declarations generated by the style engine. |
| wp_add_state_style_group( &$groups, $selector, $style ) X-Ref |
| Adds a style fragment to a selector-keyed state style group. param: array $groups Selector-keyed style groups. param: string|null $selector Block or feature selector. param: array $style Style fragment. |
| wp_get_state_style_groups( $state_style, $block_selectors ) X-Ref |
| Splits a state style object into groups based on block feature selectors. return: array[] Selector/style groups. param: array $state_style State style object. param: array $block_selectors Block selectors metadata. |
| wp_get_root_state_style( $state_style, $nested_keys ) X-Ref |
| Returns a style object with nested state keys removed. return: array Root-only style object. param: array $state_style State style object. param: array $nested_keys Keys to remove from the root style object. |
| wp_get_block_state_style_rules( $state_styles, $block_type, $rules_group = null ) X-Ref |
| Builds compiled state style rules, preserving the selector each rule targets. return: array[] State style rules. param: array $state_styles Map of state to style array. param: WP_Block_Type $block_type Block type. param: string|null $rules_group Optional CSS grouping rule, e.g. a media query. |
| wp_get_block_state_unique_class( $block_name, $css_rules ) X-Ref |
| Returns a unique class for a set of state style rules. return: string Unique class name. param: string $block_name Block name. param: array $css_rules State style rules. |
| wp_split_selector_list( $selector ) X-Ref |
| Splits a selector list by top-level commas. return: string[] Selectors. param: string $selector CSS selector list. |
| wp_build_state_selector( $base_selector, $block_selector, $state ) X-Ref |
| Builds a scoped selector from a block selector and optional pseudo-state. return: string Scoped selector. param: string $base_selector Block-instance scoping selector. param: string|null $block_selector Block or feature selector from metadata. param: string $state Pseudo-state selector. |
| wp_render_block_states_support( $block_content, $block ) X-Ref |
| Renders per-instance state styles on the frontend. return: string Modified block content with injected state styles. param: string $block_content The block's rendered HTML. param: array $block The block data including blockName and attrs. |
| Generated : Sat Jun 13 09:38:55 2026 | Cross-referenced by PHPXref |