[ 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.

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

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

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

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.

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

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.

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



Generated : Wed May 8 08:20:02 2024 Cross-referenced by PHPXref