You are here

function _graphql_decorate_deprecated_type in GraphQL 8.3

Helper function to decorate legacy definitions.

Parameters

array $definitions: A plugin definitions array.

4 calls to _graphql_decorate_deprecated_type()
graphql_graphql_fields_alter in ./graphql.module
Implements hook_graphql_fields_alter().
graphql_graphql_input_types_alter in ./graphql.module
Implements hook_graphql_input_types_alter().
graphql_graphql_mutations_alter in ./graphql.module
Implements hook_graphql_mutations_alter().
graphql_graphql_subscriptions_alter in ./graphql.module
Implements hook_graphql_mutations_alter().

File

./graphql.module, line 95

Code

function _graphql_decorate_deprecated_type(array &$definitions) {
  foreach ($definitions as &$definition) {
    if (!empty($definition['type'])) {
      if (!empty($definition['multi'])) {
        $definition['type'] = StringHelper::listType($definition['type']);
      }
      if (isset($definition['nullable']) && empty($definition['nullable'])) {
        $definition['type'] = StringHelper::nonNullType($definition['type']);
      }
    }
    if (!empty($definition['fields'])) {
      _graphql_decorate_deprecated_type($definition['fields']);
    }
    if (!empty($definition['arguments'])) {
      _graphql_decorate_deprecated_type($definition['arguments']);
    }
  }
}