ACF_Location_User_Form::match()publicACF 5.9.0

Matches the provided rule against the screen args returning a bool result.

Метод класса: ACF_Location_User_Form{}

Хуков нет.

Возвращает

true|false.

Использование

$ACF_Location_User_Form = new ACF_Location_User_Form();
$ACF_Location_User_Form->match( $rule, $screen, $field_group );
$rule(массив) (обязательный)
The location rule.
$screen(массив) (обязательный)
The screen args.
$field_group(массив) (обязательный)
The field group settings.

Список изменений

С версии 5.9.0 Введена.

Код ACF_Location_User_Form::match() ACF 6.0.4

public function match( $rule, $screen, $field_group ) {
	// REST API has no forms, so we should always allow it.
	if ( ! empty( $screen['rest'] ) ) {
		return true;
	}

	// Check screen args.
	if ( isset( $screen['user_form'] ) ) {
		$user_form = $screen['user_form'];
	} else {
		return false;
	}

	// The "Add / Edit" choice (foolishly valued "edit") should match true for either "add" or "edit".
	if ( $rule['value'] === 'edit' && $user_form === 'add' ) {
		$user_form = 'edit';
	}

	// Compare rule against $user_form.
	return $this->compare_to_rule( $user_form, $rule );
}