Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Forms_Dynamic_Fields::remove_block( array $block, array[] $blocks, array $parent = null )
Remove block from the list which contains it.
Parameters Parameters
- $block
-
(array) (Required) Parsed WP_Block array.
- $blocks
-
(array[]) (Required) Array of parsed WP_Block arrays (passed by reference).
- $parent
-
(array) (Optional) Parsed WP_Block array representing the parent block of the
$blocks
, in case this is a list of inner blocks. Passed by reference.Default value: null
Return Return
(bool)
Source Source
File: includes/forms/class-llms-forms-dynamic-fields.php
private function remove_block( $block, &$blocks, &$parent = null ) { foreach ( $blocks as $index => &$_block ) { if ( $_block === $block ) { array_splice( $blocks, $index, 1 ); // Remove and re-index. // If we're removing an innerBlock we need to update the innerContent too, to avoid wp calling the render method on nulls. if ( ! is_null( $parent ) ) { $this->remove_inner_block_from_inner_content( $index, $parent ); } return true; } if ( ! empty( $_block['innerBlocks'] ) ) { $removed = $this->remove_block( $block, $_block['innerBlocks'], $_block ); } if ( ! empty( $removed ) ) { // Break as soon as the desired block is removed from one of the innerBlocks. return true; } } return false; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.1.0 | Introduced. |