You are here

public function DisplayModeIdDeriver::getDerivativeDefinitions in GraphQL 8.3

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

modules/graphql_core/src/Plugin/Deriver/Enums/DisplayModeIdDeriver.php, line 43

Class

DisplayModeIdDeriver

Namespace

Drupal\graphql_core\Plugin\Deriver\Enums

Code

public function getDerivativeDefinitions($basePluginDefinition) {
  foreach ($this
    ->getDisplayModes() as $targetType => $displayModes) {
    $this->derivatives[$targetType] = [
      'name' => StringHelper::camelCase($targetType, 'display', 'mode', 'id'),
      'description' => $this
        ->t("The available display modes for '@type' entities.", [
        '@type' => $this->entityTypeManager
          ->getDefinition($targetType)
          ->getLabel(),
      ]),
      'values' => $displayModes,
    ] + $basePluginDefinition;
  }
  return parent::getDerivativeDefinitions($basePluginDefinition);
}