Automattic\WooCommerce\Api\Utils
SchemaHandle::read_element_authorization
Read authorization descriptors from a field-/arg-/enum-value-level config.
Mirrors {@see self::read_element_metadata()} but pulls the authorization key. Returns an empty list when the element carries no authorization descriptors.
Method of the class: SchemaHandle{}
No Hooks.
Returns
list
Usage
$result = SchemaHandle::read_element_authorization( $element ): array;
- $element(object) (required)
- FieldDefinition | Argument | InputObjectField | EnumValueDefinition.
SchemaHandle::read_element_authorization() SchemaHandle::read element authorization code WC 10.9.1
private static function read_element_authorization( object $element ): array {
if ( ! property_exists( $element, 'config' ) ) {
return array();
}
$authorization = $element->config['authorization'] ?? array();
return is_array( $authorization ) ? $authorization : array();
}