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.
Метод класса: Schema{}
Хуков нет.
Возвращает
array. Associative array of type => properties
Использование
$result = Schema::get_properties_by_type();
Список изменений
| С версии 6.8.0 | Введена. |
Код Schema::get_properties_by_type() Schema::get properties by type ACF 6.8.11
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;
}