You are here

public function Label::resolve in GraphQL 8.4

Same name in this branch
  1. 8.4 src/Plugin/GraphQL/DataProducer/EntityDefinition/Label.php \Drupal\graphql\Plugin\GraphQL\DataProducer\EntityDefinition\Label::resolve()
  2. 8.4 src/Plugin/GraphQL/DataProducer/EntityDefinition/Fields/Label.php \Drupal\graphql\Plugin\GraphQL\DataProducer\EntityDefinition\Fields\Label::resolve()

Resolves the field label.

Parameters

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

Return value

string The field label.

File

src/Plugin/GraphQL/DataProducer/EntityDefinition/Fields/Label.php, line 36

Class

Label
Retrieves the "label" from a given field definition.

Namespace

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

Code

public function resolve(FieldDefinitionInterface $entity_definition_field) : string {

  // Convert to string as label can be also TranslatableMarkup object.
  return (string) $entity_definition_field
    ->getLabel();
}