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::modify_toggle_blocks( array[] $blocks )

Modifies block settings for toggle-controlled fields


Parameters Parameters

$blocks

(array[]) (Required) Array of WP_Block arrays.


Top ↑

Return Return

(array[])


Top ↑

Source Source

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

	private function modify_toggle_blocks( $blocks ) {

		// List of toggle fields to modify.
		$fields = array(
			'email_address',
			'email_address_confirm',
			'password',
			'password_confirm',
		);

		foreach ( $blocks as &$block ) {

			if ( ! empty( $block['innerBlocks'] ) ) {
				$block['innerBlocks'] = $this->modify_toggle_blocks( $block['innerBlocks'] );
			} elseif ( ! empty( $block['attrs']['id'] ) && in_array( $block['attrs']['id'], $fields, true ) ) {
				$block['attrs']['wrapper_classes'] = 'llms-visually-hidden-field';
				$block['attrs']['disabled']        = true;
				$block['attrs']['required']        = true;
			}
		}

		return $blocks;
	}


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.