You are here

public function ConfigTranslationLocalTasks::getDerivativeDefinitions in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/config_translation/src/Plugin/Derivative/ConfigTranslationLocalTasks.php \Drupal\config_translation\Plugin\Derivative\ConfigTranslationLocalTasks::getDerivativeDefinitions()

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

core/modules/config_translation/src/Plugin/Derivative/ConfigTranslationLocalTasks.php, line 55

Class

ConfigTranslationLocalTasks
Provides dynamic local tasks for config translation.

Namespace

Drupal\config_translation\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $mappers = $this->mapperManager
    ->getMappers();
  foreach ($mappers as $plugin_id => $mapper) {

    /** @var \Drupal\config_translation\ConfigMapperInterface $mapper */
    $route_name = $mapper
      ->getOverviewRouteName();
    $base_route = $mapper
      ->getBaseRouteName();
    if (!empty($base_route)) {
      $this->derivatives[$route_name] = $base_plugin_definition;
      $this->derivatives[$route_name]['config_translation_plugin_id'] = $plugin_id;
      $this->derivatives[$route_name]['class'] = '\\Drupal\\config_translation\\Plugin\\Menu\\LocalTask\\ConfigTranslationLocalTask';
      $this->derivatives[$route_name]['route_name'] = $route_name;
      $this->derivatives[$route_name]['base_route'] = $base_route;
    }
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}