ACF\AI\GEO
Schema::get_properties_by_type
Get all properties grouped by type
Returns an associative array where keys are type names and values are arrays of property names that belong to that type.
Method of the class: Schema{}
No Hooks.
Returns
Array. Associative array of type => properties
Usage
$result = Schema::get_properties_by_type();
Changelog
| Since 6.8.0 | Introduced. |
Schema::get_properties_by_type() Schema::get properties by type code ACF 6.8.8
public static function get_properties_by_type() {
// Return cached result if available.
if ( self::$properties_by_type_cache !== null ) {
return self::$properties_by_type_cache;
}
$properties_by_type = array();
$property_domains = SchemaData::get_property_domains();
// Build reverse mapping from properties to types
foreach ( $property_domains as $property => $types ) {
foreach ( $types as $type ) {
if ( ! isset( $properties_by_type[ $type ] ) ) {
$properties_by_type[ $type ] = array();
}
$properties_by_type[ $type ][] = $property;
}
}
// Sort properties within each type
foreach ( $properties_by_type as $type => $properties ) {
sort( $properties_by_type[ $type ] );
}
// Sort by type name
ksort( $properties_by_type );
// Cache the result.
self::$properties_by_type_cache = $properties_by_type;
return $properties_by_type;
}