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


(array) (Required) Parsed block array.

Top ↑

Return Return


Top ↑

Source Source

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

	 * @param array $block Parsed block array.
	 * @return bool
	private function is_block_visible( $block ) {

		// Make the block return a non empty string if it's visible, it will already automatically return an empty string if it's invisible.
		add_filter( 'render_block', array( __CLASS__, '__return_string' ), 5 );

		// Don't run this class render function on the block during this test.
		remove_filter( 'render_block', array( $this, 'render_field_block' ), 10, 2 );

		// Render the block.
		$render = render_block( $block );

		// Cleanup / reapply filters.
		add_filter( 'render_block', array( $this, 'render_field_block' ), 10, 2 );
		remove_filter( 'render_block', array( __CLASS__, '__return_string' ), 5 );

		 * Filter whether or not the block is visible.
		 * @since 5.0.0
		 * @param bool  $visible Whether or not the block is visible.
		 * @param array $block   Parsed block array.

Top ↑

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.