You are here

public function Status::resolve in GraphQL 8.4

Resolves the "status" property.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $entity_definition_field: The entity field definition.

Return value

bool If the field config is enabled or not.

File

src/Plugin/GraphQL/DataProducer/EntityDefinition/Fields/Status.php, line 39

Class

Status
Retrieves the "status" property from a given field definition.

Namespace

Drupal\graphql\Plugin\GraphQL\DataProducer\EntityDefinition\Fields

Code

public function resolve(FieldDefinitionInterface $entity_definition_field) : bool {
  if ($entity_definition_field instanceof BaseFieldDefinition) {

    /** @var \Drupal\Core\Field\BaseFieldDefinition $entity_definition_field */
    return TRUE;
  }
  elseif ($entity_definition_field instanceof FieldConfig) {

    /** @var \Drupal\field\Entity\FieldConfig $entity_definition_field */
    return $entity_definition_field
      ->status();
  }
  elseif ($entity_definition_field instanceof BaseFieldOverride) {

    /** @var \Drupal\Core\Field\Entity\BaseFieldOverride $entity_definition_field */
    return $entity_definition_field
      ->status();
  }
  return FALSE;
}