LLMS_Forms::is_block_visible_in_list( array $block, array[] $block_list )
Determine if a block is visible in the list it’s contained based on LifterLMS Visibility Settings
Description Description
Fall back on $this->is_block_visible() if empty $block_list is provided.
Parameters Parameters
- $block
-
(array) (Required) Parsed block array.
- $block_list
-
(array[]) (Required) The list of WP Block array
$blockcomes from.
Return Return
(bool) Returns true if $block (and all its parents) are visible. Returns false when $block or any of its parents are hidden or when $block is not found within $block_list.
Source Source
File: includes/forms/class-llms-forms.php
* @param array $block Parsed block array.
* @param array[] $block_list The list of WP Block array `$block` comes from.
*/
return apply_filters( 'llms_forms_is_block_visible', $is_visible, $block, $block_list );
}
/**
* Returns a list of block parents plus the block itself in reverse order
*
* @since 5.1.0
*
* @param array $block Parsed block array.
* @param array[] $block_list The list of WP Block array `$block` comes from.
* @param int $iterations Stores the number of iterations.
* @return array[] List of WP_Block arrays or an empty array if `$block` cannot be found within `$block_list`.
*/
private function get_block_path( $block, $block_list, $iterations = 0 ) {
foreach ( $block_list as $_block ) {
// Found the block.
if ( $block === $_block ) {
return array( $block );
}
// No innerblocks, proceed to the next block.
if ( empty( $_block['innerBlocks'] ) ) {
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 5.1.0 | Introduced. |