Automattic\WooCommerce\Vendor\GraphQL\Executor
ReferenceExecutor::shouldIncludeNode
Determines if a field should be included based on the @include and @skip directives, where @skip has higher precedence than @include.
Method of the class: ReferenceExecutor{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->shouldIncludeNode( $node ): bool;
- $node(FragmentSpreadNode|FieldNode|InlineFragmentNode) (required)
- .
ReferenceExecutor::shouldIncludeNode() ReferenceExecutor::shouldIncludeNode code WC 10.9.1
protected function shouldIncludeNode(SelectionNode $node): bool
{
$variableValues = $this->exeContext->variableValues;
$schema = $this->exeContext->schema;
$skip = Values::getDirectiveValues(
Directive::skipDirective(),
$node,
$variableValues,
$schema,
);
if (isset($skip['if']) && $skip['if'] === true) {
return false;
}
$include = Values::getDirectiveValues(
Directive::includeDirective(),
$node,
$variableValues,
$schema,
);
return ! isset($include['if']) || $include['if'] !== false;
}