ACF\AI\GEO

Schema::property_expects_objectpublic staticACF 6.8.0

Check if a property expects an object (not a primitive type)

Returns true if the property expects a schema.org Type as its value, meaning it should be a nested object with @type.

Primitive types: Text, Number, Boolean, Date, DateTime, Time, URL, etc.

Method of the class: Schema{}

No Hooks.

Returns

true|false. True if property expects an object

Usage

$result = Schema::property_expects_object( $property );
$property(string) (required)
The property name.

Changelog

Since 6.8.0 Introduced.

Schema::property_expects_object() code ACF 6.8.8

public static function property_expects_object( $property ) {
	$range = self::get_property_range( $property );

	if ( empty( $range ) ) {
		return false;
	}

	// If any range type is not a primitive, it expects an object
	foreach ( $range as $type ) {
		if ( ! in_array( $type, self::$primitive_types, true ) ) {
			return true;
		}
	}

	return false;
}