public function MaxNumItems::resolve in GraphQL 8.4
Resolves the "max_num_items" property.
Parameters
\Drupal\Core\Field\FieldDefinitionInterface $entity_definition_field: The entity field definition.
Return value
int The maximum number of items for a field.
File
- src/
Plugin/ GraphQL/ DataProducer/ EntityDefinition/ Fields/ MaxNumItems.php, line 37
Class
- MaxNumItems
- Retrieves the "max_num_items" property from a given field definition.
Namespace
Drupal\graphql\Plugin\GraphQL\DataProducer\EntityDefinition\FieldsCode
public function resolve(FieldDefinitionInterface $entity_definition_field) : int {
if ($entity_definition_field instanceof BaseFieldDefinition) {
return $entity_definition_field
->getCardinality();
}
return $entity_definition_field
->getFieldStorageDefinition()
->getCardinality();
}