You are here

protected function ArgumentAwarePluginTrait::buildArguments in GraphQL 8.3

Builds the list of arguments.

Parameters

array $definition: The plugin definition array.

Return value

array The list of arguments.

3 calls to ArgumentAwarePluginTrait::buildArguments()
FieldPluginBase::getDefinition in src/Plugin/GraphQL/Fields/FieldPluginBase.php
Returns the plugin's type or field definition for the schema.
MutationPluginBase::getDefinition in src/Plugin/GraphQL/Mutations/MutationPluginBase.php
Returns the plugin's type or field definition for the schema.
SubscriptionPluginBase::getDefinition in src/Plugin/GraphQL/Subscriptions/SubscriptionPluginBase.php
Returns the plugin's type or field definition for the schema.

File

src/Plugin/GraphQL/Traits/ArgumentAwarePluginTrait.php, line 18

Class

ArgumentAwarePluginTrait

Namespace

Drupal\graphql\Plugin\GraphQL\Traits

Code

protected function buildArguments($definition) {
  return array_map(function ($argument) use ($definition) {
    return [
      'optional' => !empty($argument['optional']),
      'type' => $this
        ->buildArgumentType($argument, $definition),
      'description' => $this
        ->buildArgumentDescription($argument, $definition),
      'defaultValue' => $this
        ->buildArgumentDefault($argument, $definition),
    ];
  }, $definition['arguments']);
}