public function ContentTranslationLocalTasks::getDerivativeDefinitions in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 8 src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
- 8.2 src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
- 4.0.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
- 3.0.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
- 3.1.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
- 3.2.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
- 3.3.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
- 3.5.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
- 3.6.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
- 3.7.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks::getDerivativeDefinitions()
- 3.8.x src/Plugin/Derivative/ContentTranslationLocalTasks.php \Drupal\lingotek\Plugin\Derivative\ContentTranslationLocalTasks::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
- src/
Plugin/ Derivative/ ContentTranslationLocalTasks.php, line 58
Class
- ContentTranslationLocalTasks
- Provides dynamic local tasks for Lingotek content translation management.
Namespace
Drupal\lingotek\Plugin\DerivativeCode
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) {
$translation_route_name = "lingotek.manage.{$entity_type_id}";
// If it's a paragraph, we depend on the preference.
if ($entity_type_id === 'paragraph') {
$config = \Drupal::config('lingotek.settings');
$enable_bulk_management = $config
->get('preference.contrib.paragraphs.enable_bulk_management', FALSE);
if (!$enable_bulk_management) {
// If already existed remove it.
if (isset($this->derivatives[$translation_route_name])) {
unset($this->derivatives[$translation_route_name]);
}
continue;
}
}
if ($entity_type_id === 'cohesion_layout') {
if (isset($this->derivatives[$translation_route_name])) {
unset($this->derivatives[$translation_route_name]);
}
continue;
}
$has_canonical_path = $entity_type
->hasLinkTemplate('canonical');
// Create the entries for the tabs in the bulk manage pages.
$base_route_name = "lingotek.manage";
$this->derivatives[$translation_route_name] = [
'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] = [
'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);
}