Automattic\WooCommerce\Vendor\GraphQL\Executor
Values::getDirectiveValues
Prepares an object map of argument values given a directive definition and an AST node which may contain directives. Optionally also accepts a map of variable values.
If the directive does not exist on the node, returns undefined.
Method of the class: Values{}
No Hooks.
Returns
Array
Usage
$result = Values::getDirectiveValues( $directiveDef, $node, ?array $variableValues, ?Schema $schema ): ?array;
- $directiveDef(Directive) (required)
- .
- $node(EnumTypeDefinitionNode|EnumTypeExtensionNode|EnumValueDefinitionNode|FieldDefinitionNode|FieldNode|FragmentDefinitionNode|FragmentSpreadNode|InlineFragmentNode|InputObjectTypeDefinitionNode|InputObjectTypeExtensionNode|InputValueDefinitionNode|InterfaceTypeDefinitionNode|InterfaceTypeExtensionNode|ObjectTypeDefinitionNode|ObjectTypeExtensionNode|OperationDefinitionNode|ScalarTypeDefinitionNode|ScalarTypeExtensionNode|SchemaExtensionNode|UnionTypeDefinitionNode|UnionTypeExtensionNode|VariableDefinitionNode) (required)
- .
- ?array $variableValues
- .
Default:null - ?Schema $schema
- .
Default:null
Values::getDirectiveValues() Values::getDirectiveValues code WC 10.9.1
public static function getDirectiveValues(Directive $directiveDef, Node $node, ?array $variableValues = null, ?Schema $schema = null): ?array
{
$directiveDefName = $directiveDef->name;
foreach ($node->directives as $directive) {
if ($directive->name->value === $directiveDefName) {
return self::getArgumentValues($directiveDef, $directive, $variableValues, $schema);
}
}
return null;
}