You are here

public function SchemaPluginBase::getFields in GraphQL 8.3

Retrieves the fields for a given type.

Parameters

string $type: The name of the type to retrieve the fields for.

Return value

array The fields belonging to the given type.

Overrides SchemaBuilderInterface::getFields

1 call to SchemaPluginBase::getFields()
SchemaPluginBase::getSchema in src/Plugin/GraphQL/Schemas/SchemaPluginBase.php
Retrieves the schema.

File

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

Class

SchemaPluginBase

Namespace

Drupal\graphql\Plugin\GraphQL\Schemas

Code

public function getFields($type) {
  $association = $this->pluginDefinition['field_association_map'];
  $fields = $this->pluginDefinition['field_map'];
  if (isset($association[$type])) {
    return $this
      ->processFields(array_map(function ($id) use ($fields) {
      return $fields[$id];
    }, $association[$type]));
  }
  return [];
}