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::make_block_visible( array $block, array[] $blocks, int $block_index )
Make a block visible within its list of blocks
Parameters Parameters
- $block
-
(array) (Required) Parsed WP_Block array.
- $blocks
-
(array[]) (Required) Array of parsed WP_Block arrays.
- $block_index
-
(int) (Required) Index of the block within the
$blocks
list. If the block is in a group, this is the the index of the item's parent.
Return Return
(array[])
Source Source
File: includes/forms/class-llms-forms-dynamic-fields.php
private function make_block_visible( $block, $blocks, $block_index ) { if ( LLMS_Forms::instance()->is_block_visible_in_list( $block, array( $blocks[ $block_index ] ) ) ) { return $blocks; } // If the block has a confirm group, use that. $confirm = $this->get_confirm_group( $block['attrs']['id'], array( $blocks[ $block_index ] ) ); $block_to_add = empty( $confirm ) ? $block : $confirm; $replace = true; // Insert the visible block before the invisible one if the block is in a group, // so to avoid the replacement of the whole group which might contain other required fields. // But replace the invisible with the visible if otherwise. if ( $block_to_add !== $blocks[ $block_index ] ) { $replace = false; $this->remove_block( $block_to_add, $blocks ); } // Make the block to add and its children visible. $block_to_add = $this->make_all_visible( $block_to_add ); array_splice( $blocks, $block_index, (int) ( ! empty( $replace ) ), array( $block_to_add ) ); return $blocks; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.1.0 | Introduced. |