You are here

public function Numbers::buildEnumValues in GraphQL 8.3

Builds the enum values.

Parameters

array $definition: The plugin definition array/

Return value

array The enum values.

Overrides EnumPluginBase::buildEnumValues

File

tests/modules/graphql_enum_test/src/Plugin/GraphQL/Enums/Numbers.php, line 39

Class

Numbers
Generates an enumeration of numbers.

Namespace

Drupal\graphql_enum_test\Plugin\GraphQL\Enums

Code

public function buildEnumValues($definition) {
  $values = [];
  foreach (static::$NUMBERS as $num => $word) {
    $values[strtoupper($word)] = [
      'value' => $num,
      'description' => ucfirst($word),
    ];
  }
  return $values;
}