class ContentEntityLingotekActionDeriver in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 8.2 src/Plugin/Action/Derivative/ContentEntityLingotekActionDeriver.php \Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver
- 3.0.x src/Plugin/Action/Derivative/ContentEntityLingotekActionDeriver.php \Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver
- 3.1.x src/Plugin/Action/Derivative/ContentEntityLingotekActionDeriver.php \Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver
- 3.2.x src/Plugin/Action/Derivative/ContentEntityLingotekActionDeriver.php \Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver
- 3.3.x src/Plugin/Action/Derivative/ContentEntityLingotekActionDeriver.php \Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver
- 3.4.x src/Plugin/Action/Derivative/ContentEntityLingotekActionDeriver.php \Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver
- 3.5.x src/Plugin/Action/Derivative/ContentEntityLingotekActionDeriver.php \Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver
- 3.6.x src/Plugin/Action/Derivative/ContentEntityLingotekActionDeriver.php \Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver
- 3.7.x src/Plugin/Action/Derivative/ContentEntityLingotekActionDeriver.php \Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver
- 3.8.x src/Plugin/Action/Derivative/ContentEntityLingotekActionDeriver.php \Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\Core\Action\Plugin\Action\Derivative\EntityActionDeriverBase implements ContainerDeriverInterface uses StringTranslationTrait
- class \Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver
- class \Drupal\Core\Action\Plugin\Action\Derivative\EntityActionDeriverBase implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of ContentEntityLingotekActionDeriver
File
- src/
Plugin/ Action/ Derivative/ ContentEntityLingotekActionDeriver.php, line 11
Namespace
Drupal\lingotek\Plugin\Action\DerivativeView source
class ContentEntityLingotekActionDeriver extends EntityActionDeriverBase {
/**
* {@inheritdoc}
*/
protected function isApplicable(EntityTypeInterface $entity_type) {
return TRUE;
/** @var \Drupal\lingotek\LingotekConfigurationServiceInterface $drupalConfiguration */
$drupalConfiguration = \Drupal::service('lingotek.configuration');
return $drupalConfiguration
->isEnabled($entity_type
->id());
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$definitions = parent::getDerivativeDefinitions($base_plugin_definition);
if (!empty($definitions)) {
$entity_types = $this->entityTypeManager
->getDefinitions();
foreach ($this->derivatives as $entity_type_id => &$definition) {
$definition['label'] = new FormattableMarkup($base_plugin_definition['action_label'], [
'@entity_label' => $entity_types[$entity_type_id]
->getSingularLabel(),
]);
if (in_array($definition['class'], [
DeleteAllTranslationsAction::class,
DeleteTranslationLingotekAction::class,
])) {
$definition['confirm_form_route_name'] = 'entity.' . $entity_type_id . '.delete_multiple_form';
}
}
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentEntityLingotekActionDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides EntityActionDeriverBase:: |
|
ContentEntityLingotekActionDeriver:: |
protected | function |
Indicates whether the deriver can be used for the provided entity type. Overrides EntityActionDeriverBase:: |
|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
EntityActionDeriverBase:: |
protected | property | The entity type manager. | |
EntityActionDeriverBase:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
EntityActionDeriverBase:: |
protected | function | Gets a list of applicable entity types. | |
EntityActionDeriverBase:: |
public | function | Constructs a new EntityActionDeriverBase object. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
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. |