function ContentTranslationLocalTasks::getDerivativeDefinitions

Same name and namespace in other branches
  1. 9 core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\content_translation\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
  2. 8.9.x core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\content_translation\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
  3. 10 core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\content_translation\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()

Overrides DeriverBase::getDerivativeDefinitions

File

core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php, line 62

Class

ContentTranslationLocalTasks
Provides dynamic local tasks for content translation.

Namespace

Drupal\content_translation\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
    // Create tabs for all possible entity types.
    foreach ($this->contentTranslationManager
        ->getSupportedEntityTypes() as $entity_type_id => $entity_type) {
        // Find the route name for the translation overview.
        $translation_route_name = "entity.{$entity_type_id}.content_translation_overview";
        $base_route_name = "entity.{$entity_type_id}.canonical";
        $this->derivatives[$translation_route_name] = [
            'entity_type' => $entity_type_id,
            'title' => $this->t('Translate'),
            'route_name' => $translation_route_name,
            'base_route' => $base_route_name,
        ] + $base_plugin_definition;
    }
    return parent::getDerivativeDefinitions($base_plugin_definition);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.