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 entity definition label.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_definition: The entity type definition.

Return value

string The entity definition label.

File

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

Class

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

Namespace

Drupal\graphql\Plugin\GraphQL\DataProducer\EntityDefinition

Code

public function resolve(EntityTypeInterface $entity_definition) : string {

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