You are here

public function ContentTranslationContextualLinks::getDerivativeDefinitions in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php \Drupal\content_translation\Plugin\Derivative\ContentTranslationContextualLinks::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/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php, line 46

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'] = 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);
}