ACF\AI\GEO
GEO::determine_schema_type
Determine the final "@type" value for JSON-LD output
Merges provided types (from post type/block settings) with field types (from qualified properties like "Recipe.prepTime"). Falls back to the default type if neither source provides any types.
Метод класса: GEO{}
Хуков нет.
Возвращает
string|array. Final @type value (string for single type, array for multiple).
Использование
$result = GEO::determine_schema_type( $provided_types, $field_types, $default_type );
- $provided_types(строка|массив|null) (обязательный)
- Types explicitly set in settings (can be string, array, or null).
- $field_types(массив) (обязательный)
- Types extracted from qualified properties.
- $default_type(строка)
- Fallback type if no types provided.
По умолчанию:'Thing'
Список изменений
| С версии 6.8.0 | Введена. |
Код GEO::determine_schema_type() GEO::determine schema type ACF 6.8.8
public static function determine_schema_type( $provided_types, $field_types, $default_type = 'Thing' ) {
$types = array();
// Add provided types from post type/block settings.
if ( ! empty( $provided_types ) ) {
$types = is_array( $provided_types ) ? $provided_types : array( $provided_types );
}
// Merge in field types from qualified properties.
if ( ! empty( $field_types ) && is_array( $field_types ) ) {
$types = array_merge( $types, $field_types );
}
$types = array_values( array_unique( $types ) );
if ( empty( $types ) ) {
return $default_type;
}
return count( $types ) === 1 ? $types[0] : $types;
}