make_before_block_visitor


make_before_block_visitor ( $hooked_blocks, $context, $callback = 'insert_hooked_blocks' )

Access:
  • private
Parameters:
  • (array) hooked_blocks An array of blocks hooked to another given block.
  • (WP_Block_Template|WP_Post|array) context A block template, template part, `wp_navigation` post object, or pattern that the blocks belong to.
  • (callable) callback A function that will be called for each block to generate the markup for a given list of blocks that are hooked to it. Default: 'insert_hooked_blocks'.
Returns:
  • (callable) A function that returns the serialized markup for the given block, including the markup for any hooked blocks before it.
Defined at:
Change Log:
  • 6: .

Description

Returns a function that injects the theme attribute into, and hooked blocks before, a given block.The returned function can be used as `$pre_callback` argument to `traverse_and_serialize_block(s)`, where it will inject the `theme` attribute into all Template Part blocks, and prepend the markup for any blocks hooked `before` the given block and as its parent's `first_child`, respectively. This function is meant for internal use only.

Related Functions

make_after_block_visitor, before_last_bar, parse_blocks, wp_use_widgets_block_editor, block_version

Top Google Results

User discussions

wpseek mobile