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::is_block_visible( array $block )

Determine if a block is visible based on LifterLMS Visibility Settings.


Parameters Parameters

$block

(array) (Required) Parsed block array.


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: includes/forms/class-llms-forms.php

		 * @param bool  $visible Whether or not the block is visible.
		 * @param array $block   Parsed block array.
		 */
		return apply_filters( 'llms_forms_is_block_visible', llms_parse_bool( $render ), $block );
	}

	/**
	 * Determine if a block is visible in the list it's contained based on LifterLMS Visibility Settings
	 *
	 * Fall back on `$this->is_block_visible()` if empty `$block_list` is provided.
	 *
	 * @since 5.1.0
	 *
	 * @param array   $block      Parsed block array.
	 * @param array[] $block_list The list of WP Block array `$block` comes from.
	 * @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`.
	 */
	public function is_block_visible_in_list( $block, $block_list ) {

		if ( empty( $block_list ) ) {
			return $this->is_block_visible( $block );
		}

		$path       = $this->get_block_path( $block, $block_list );
		$is_visible = ! empty( $path ); // Assume the block is visible until proven hidden, except when path is empty.

Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.