ACF\AI\GEO

FieldSettings::get_compatible_properties_setprivateACF 6.8.0

Get compatible properties as a set (for fast lookup)

Uses pre-computed data from SchemaData::get_compatible_properties().

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

Хуков нет.

Возвращает

array. Properties as keys for O(1) lookup.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_compatible_properties_set( $field_type );
$field_type(строка) (обязательный)
The ACF field type name.

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

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

Код FieldSettings::get_compatible_properties_set() ACF 6.8.8

private function get_compatible_properties_set( $field_type ) {
	// Get field type's output types.
	$field_ranges = Schema::get_field_type_ranges( $field_type );

	if ( empty( $field_ranges ) ) {
		return array();
	}

	// Get pre-computed compatible properties mapping.
	$compatible_by_type = SchemaData::get_compatible_properties();

	// Merge compatible properties for all output types.
	$compatible = array();
	foreach ( $field_ranges as $output_type ) {
		if ( isset( $compatible_by_type[ $output_type ] ) ) {
			foreach ( $compatible_by_type[ $output_type ] as $property ) {
				$compatible[ $property ] = true;
			}
		}
	}

	return $compatible;
}