You are here

public function SchemaPluginBase::processArguments in GraphQL 8.3

Processes a list of argument definitions.

Parameters

array $args: An array of argument definitions.

Return value

array The processed argument definitions.

Overrides SchemaBuilderInterface::processArguments

File

src/Plugin/GraphQL/Schemas/SchemaPluginBase.php, line 448

Class

SchemaPluginBase

Namespace

Drupal\graphql\Plugin\GraphQL\Schemas

Code

public function processArguments(array $args) {
  return array_filter(array_map(function ($arg) {
    try {
      $type = $this
        ->processType($arg['type']);
    } catch (\Exception $e) {

      // Allow optional arguments that are removed if the input type is
      // not defined.
      if (empty($arg['optional'])) {
        throw $e;
      }
      return NULL;
    }
    return [
      'type' => $type,
    ] + $arg;
  }, $args));
}