You are here

public function DynamicLocalTasks::getDerivativeDefinitions in String Overrides 8

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

src/Plugin/Derivative/DynamicLocalTasks.php, line 15

Class

DynamicLocalTasks
Defines dynamic local tasks (menu tabs).

Namespace

Drupal\stringoverrides\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $languages = \Drupal::languageManager()
    ->getLanguages();
  foreach ($languages as $language_code => $language) {
    $this->derivatives['stringoverrides.translations_form.' . $language_code] = [
      'title' => $language
        ->getName(),
      'base_route' => 'stringoverrides.translations_form',
      'route_name' => 'stringoverrides.translations_form',
      'route_parameters' => [
        'language' => $language_code,
      ],
      'weight' => 100,
    ] + $base_plugin_definition;
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}