[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/block-supports/ -> block-style-variations.php (summary)

Block support to enable per-section styling of block types via block style variations.

File Size: 295 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 6 functions

  wp_get_block_style_variation_name_from_class()
  wp_resolve_block_style_variation_ref_values()
  wp_render_block_style_variation_support_styles()
  wp_render_block_style_variation_class_name()
  wp_enqueue_block_style_variation_styles()
  wp_register_block_style_variations_from_theme_json_partials()

Functions
Functions that are not part of a class:

wp_get_block_style_variation_name_from_class( $class_string )   X-Ref
Determines the block style variation names within a CSS class string.

param: string $class_string CSS class string to look for a variation in.
return: array|null The block style variation name if found.

wp_resolve_block_style_variation_ref_values( &$variation_data, $theme_json )   X-Ref
Recursively resolves any `ref` values within a block style variation's data.

param: array $variation_data Reference to the variation data being processed.
param: array $theme_json     Theme.json data to retrieve referenced values from.

wp_render_block_style_variation_support_styles( $parsed_block )   X-Ref
Renders the block style variation's styles.

In the case of nested blocks with variations applied, we want the parent
variation's styles to be rendered before their descendants. This solves the
issue of a block type being styled in both the parent and descendant: we want
the descendant style to take priority, and this is done by loading it after,
in the DOM order. This is why the variation stylesheet generation is in a
different filter.

param: array $parsed_block The parsed block.
return: array The parsed block with block style variation classname added.

wp_render_block_style_variation_class_name( $block_content, $block )   X-Ref
Ensures the variation block support class name generated and added to
block attributes in the `render_block_data` filter gets applied to the
block's markup.

param: string $block_content Rendered block content.
param: array  $block         Block object.
return: string                Filtered block content.

wp_enqueue_block_style_variation_styles()   X-Ref
Enqueues styles for block style variations.


wp_register_block_style_variations_from_theme_json_partials( $variations )   X-Ref
Registers block style variations read in from theme.json partials.

param: array $variations Shared block style variations.



Generated : Tue Dec 24 08:20:01 2024 Cross-referenced by PHPXref