[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

Elements styles block support.

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

Defines 4 functions

  wp_get_elements_class_name()
  wp_should_add_elements_class_name()
  wp_render_elements_support_styles()
  wp_render_elements_class_name()

Functions
Functions that are not part of a class:

wp_get_elements_class_name( $block )   X-Ref
Gets the elements class names.

param: array $block Block object.
return: string The unique class name.

wp_should_add_elements_class_name( $block, $options )   X-Ref
Determines whether an elements class name should be added to the block.

param: array $block   Block object.
param: array $options Per element type options e.g. whether to skip serialization.
return: boolean Whether the block needs an elements class name.

wp_render_elements_support_styles( $parsed_block )   X-Ref
Render the elements stylesheet and adds elements class name to block as required.

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.

param: array $parsed_block The parsed block.
return: array The same parsed block with elements classname added if appropriate.

wp_render_elements_class_name( $block_content, $block )   X-Ref
Ensure the elements 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.



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref