ACF_Compatibility::validate_field()publicACF 5.0.0

validate_field

Adds compatibility with deprecated settings

{} Это метод класса: ACF_Compatibility{}

Хуков нет.

Возвращает

Массив. $field

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

$ACF_Compatibility = new ACF_Compatibility();
$ACF_Compatibility->validate_field( $field );
$field(массив) (обязательный)
The field array.

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

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

Код ACF_Compatibility::validate_field() ACF 5.10.2

function validate_field( $field ) {

	// conditional logic data structure changed to groups in version 5.0.0
	// convert previous data (status, rules, allorany) into groups
	if ( isset( $field['conditional_logic']['status'] ) ) {

		// check status
		if ( $field['conditional_logic']['status'] ) {
			$field['conditional_logic'] = acf_convert_rules_to_groups( $field['conditional_logic']['rules'], $field['conditional_logic']['allorany'] );
		} else {
			$field['conditional_logic'] = 0;
		}
	}

	// return
	return $field;
}