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().

Method of the class: FieldSettings{}

No Hooks.

Returns

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

Usage

// private - for code of main (parent) class only
$result = $this->get_compatible_properties_set( $field_type );
$field_type(string) (required)
The ACF field type name.

Changelog

Since 6.8.0 Introduced.

FieldSettings::get_compatible_properties_set() code 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;
}