class ContentTranslationLocalTasks in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks
- 4.0.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks
- 3.0.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks
- 3.1.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks
- 3.2.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks
- 3.3.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks
- 3.4.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks
- 3.5.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks
- 3.6.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks
- 3.7.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks
- 3.8.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks
Provides dynamic local tasks for Lingotek content translation management.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of ContentTranslationLocalTasks
1 string reference to 'ContentTranslationLocalTasks'
File
- src/
Plugin/ Derivative/ ContentTranslationLocalTasks.php, line 20 - Contains \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks.
Namespace
Drupal\lingotek\Plugin\DerivativeView source
class ContentTranslationLocalTasks extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The base plugin ID
*
* @var string
*/
protected $basePluginId;
/**
* The Lingotek configuration service.
*
* @var \Drupal\lingotek\LingotekConfigurationServiceInterface
*/
protected $lingotekConfiguration;
/**
* Constructs a new ContentTranslationLocalTasks.
*
* @param string $base_plugin_id
* The base plugin ID.
* @param \Drupal\lingotek\LingotekConfigurationServiceInterface $lingotek_configuration
* The Lingotek configuration service.
*/
public function __construct($base_plugin_id, LingotekConfigurationServiceInterface $lingotek_configuration) {
$this->basePluginId = $base_plugin_id;
$this->lingotekConfiguration = $lingotek_configuration;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($base_plugin_id, $container
->get('lingotek.configuration'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$debug_enabled = \Drupal::state()
->get('lingotek.enable_debug_utilities', FALSE);
// Create tabs for all possible entity types.
foreach ($this->lingotekConfiguration
->getEnabledEntityTypes() as $entity_type_id => $entity_type) {
$has_canonical_path = $entity_type
->hasLinkTemplate('canonical');
// Create the entries for the tabs in the bulk manage pages.
$translation_route_name = "lingotek.manage.{$entity_type_id}";
$base_route_name = "lingotek.manage";
$this->derivatives[$translation_route_name] = array(
'entity_type_id' => $entity_type_id,
'title' => $entity_type
->getLabel(),
'route_name' => $translation_route_name,
'base_route' => $base_route_name,
'parent_id' => 'lingotek.manage',
) + $base_plugin_definition;
// Create the entries for the metadata tabs in the canonical entity urls.
if ($debug_enabled) {
$metadata_route_name = "lingotek.metadata.{$entity_type_id}";
$base_route_name = "entity.{$entity_type_id}." . ($has_canonical_path ? "canonical" : "edit_form");
$this->derivatives[$metadata_route_name] = array(
'title' => t('Lingotek Metadata'),
'entity_type' => $entity_type_id,
'route_name' => $metadata_route_name,
'base_route' => $base_route_name,
'weight' => 100,
) + $base_plugin_definition;
}
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentTranslationLocalTasks:: |
protected | property | The base plugin ID | |
ContentTranslationLocalTasks:: |
protected | property | The Lingotek configuration service. | |
ContentTranslationLocalTasks:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
ContentTranslationLocalTasks:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
ContentTranslationLocalTasks:: |
public | function | Constructs a new ContentTranslationLocalTasks. | |
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |