Make WordPress Core


Ignore:
Timestamp:
05/29/2024 11:55:27 AM (5 months ago)
Author:
gziolo
Message:

Interactivity API: Move directive processing to WP_Block class

Integrates the directives processing into the WP_Block class. It removes the overhead of running additional hooks when rendering blocks and simplifies the way we detect whether the directive processing should run on an interactive region of the produced final HTML for the blocks.

Introduces interactivity_process_directives filter to offer a way to opt out from directives processing. It's needed in Gutenberg: https://github.com/WordPress/gutenberg/pull/62095.

Props gziolo, cbravobernal.
Fixes #61185.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/deprecated.php

    r58090 r58234  
    63196319    return $block_content;
    63206320}
     6321
     6322/**
     6323 * Processes the directives on the rendered HTML of the interactive blocks.
     6324 *
     6325 * This processes only one root interactive block at a time because the
     6326 * rendered HTML of that block contains the rendered HTML of all its inner
     6327 * blocks, including any interactive block. It does so by ignoring all the
     6328 * interactive inner blocks until the root interactive block is processed.
     6329 *
     6330 * @since 6.5.0
     6331 * @deprecated 6.6.0
     6332 *
     6333 * @param array $parsed_block The parsed block.
     6334 * @return array The same parsed block.
     6335 */
     6336function wp_interactivity_process_directives_of_interactive_blocks( array $parsed_block ): array {
     6337    _deprecated_function( __FUNCTION__, '6.6.0' );
     6338    return $parsed_block;
     6339}
Note: See TracChangeset for help on using the changeset viewer.