function ContentTranslationContextualLinks::getDerivativeDefinitions

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

Overrides DeriverBase::getDerivativeDefinitions

File

core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php, line 49

Class

ContentTranslationContextualLinks
Provides dynamic contextual links for content translation.

Namespace

Drupal\content_translation\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
    // Create contextual links for translatable entity types.
    foreach ($this->contentTranslationManager
        ->getSupportedEntityTypes() as $entity_type_id => $entity_type) {
        $this->derivatives[$entity_type_id]['title'] = $this->t('Translate');
        $this->derivatives[$entity_type_id]['route_name'] = "entity.{$entity_type_id}.content_translation_overview";
        $this->derivatives[$entity_type_id]['group'] = $entity_type_id;
    }
    return parent::getDerivativeDefinitions($base_plugin_definition);
}

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