class ContentTranslationContextualLinks
Same name in other branches
- 8.9.x core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php \Drupal\content_translation\Plugin\Derivative\ContentTranslationContextualLinks
- 10 core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php \Drupal\content_translation\Plugin\Derivative\ContentTranslationContextualLinks
- 11.x core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php \Drupal\content_translation\Plugin\Derivative\ContentTranslationContextualLinks
Provides dynamic contextual links for content translation.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements \Drupal\Component\Plugin\Derivative\DeriverInterface
- class \Drupal\content_translation\Plugin\Derivative\ContentTranslationContextualLinks extends \Drupal\Component\Plugin\Derivative\DeriverBase implements \Drupal\Core\Plugin\Discovery\ContainerDeriverInterface uses \Drupal\Core\StringTranslation\StringTranslationTrait
Expanded class hierarchy of ContentTranslationContextualLinks
See also
\Drupal\content_translation\Plugin\Menu\ContextualLink\ContentTranslationContextualLinks
1 string reference to 'ContentTranslationContextualLinks'
- content_translation.links.contextual.yml in core/
modules/ content_translation/ content_translation.links.contextual.yml - core/modules/content_translation/content_translation.links.contextual.yml
File
-
core/
modules/ content_translation/ src/ Plugin/ Derivative/ ContentTranslationContextualLinks.php, line 16
Namespace
Drupal\content_translation\Plugin\DerivativeView source
class ContentTranslationContextualLinks extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The content translation manager.
*
* @var \Drupal\content_translation\ContentTranslationManagerInterface
*/
protected $contentTranslationManager;
/**
* Constructs a new ContentTranslationContextualLinks.
*
* @param \Drupal\content_translation\ContentTranslationManagerInterface $content_translation_manager
* The content translation manager.
*/
public function __construct(ContentTranslationManagerInterface $content_translation_manager) {
$this->contentTranslationManager = $content_translation_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container->get('content_translation.manager'));
}
/**
* {@inheritdoc}
*/
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);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
ContentTranslationContextualLinks::$contentTranslationManager | protected | property | The content translation manager. | ||
ContentTranslationContextualLinks::create | public static | function | Creates a new class instance. | Overrides ContainerDeriverInterface::create | |
ContentTranslationContextualLinks::getDerivativeDefinitions | public | function | Gets the definition of all derivatives of a base plugin. | Overrides DeriverBase::getDerivativeDefinitions | |
ContentTranslationContextualLinks::__construct | public | function | Constructs a new ContentTranslationContextualLinks. | ||
DeriverBase::$derivatives | protected | property | List of derivative definitions. | 1 | |
DeriverBase::getDerivativeDefinition | public | function | Gets the definition of a derivative plugin. | Overrides DeriverInterface::getDerivativeDefinition | |
StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 | |
StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | ||
StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | ||
StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | ||
StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 | |
StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.