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::get_required_fields_for_location( string $location, array $args )

Retrieve the fields required for a given location based on user state


Parameters Parameters

$location

(string) (Required) The request form location ID.

$args

(array) (Required) Additional arguments passed to the short-circuit filter.


Top ↑

Return Return

(array[]) Array of field_id => block_name required or an empty array if no fields required.


Top ↑

Source Source

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

	private function get_required_fields_for_location( $location, $args ) {

		$fields = array();

		if (
			( ! is_user_logged_in() && in_array( $location, array( 'checkout', 'registration' ), true ) ) ||
				( is_user_logged_in() && 'account' === $location ) ) {
			$fields = array(
				// Field ID => block name.
				'email_address' => 'email',
				'password'      => 'password',
			);
		}

		/**
		 * Filters the required block fields to add to the form
		 *
		 * @since 5.1.0
		 *
		 * @param array[] $fields   Array of field_id => block_name required.
		 * @param string  $location The request form location ID.
		 * @param array   $args     Additional arguments passed to the short-circuit filter.
		 */
		return apply_filters( 'llms_forms_required_block_fields', $fields, $location, $args );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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