You are here

public function Hidden::resolve in GraphQL 8.4

Resolves the hidden property.

Parameters

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

\Drupal\Core\Entity\Entity\EntityFormDisplay|null $entity_form_display_context: Entity form display context.

Return value

bool If the field is hidden or not.

File

src/Plugin/GraphQL/DataProducer/EntityDefinition/Fields/Hidden.php, line 43

Class

Hidden
Retrieves the "hidden" property from a given field definition.

Namespace

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

Code

public function resolve(FieldDefinitionInterface $entity_definition_field, ?EntityFormDisplay $entity_form_display_context) : bool {
  if ($entity_form_display_context) {
    $hidden = $entity_form_display_context
      ->get('hidden');
    $field_id = $entity_definition_field
      ->getName();
    if (isset($hidden[$field_id])) {
      return TRUE;
    }
    else {
      return FALSE;
    }
  }
  else {
    return FALSE;
  }
}