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

	private function is_block_visible( $block ) {

		// Make the block return `true` if it's visible, it will already automatically return an empty string if it's invisible.
		add_filter( 'render_block', '__return_true', 5 );

		// Don't run this classes 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', '__return_true', 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.
		return apply_filters( 'llms_forms_is_block_visible', llms_parse_bool( $render ), $block );


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.