class DeleteTranslationLingotekAction in Lingotek Translation 3.6.x
Same name and namespace in other branches
- 8.2 src/Plugin/Action/DeleteTranslationLingotekAction.php \Drupal\lingotek\Plugin\Action\DeleteTranslationLingotekAction
- 4.0.x src/Plugin/Action/DeleteTranslationLingotekAction.php \Drupal\lingotek\Plugin\Action\DeleteTranslationLingotekAction
- 3.0.x src/Plugin/Action/DeleteTranslationLingotekAction.php \Drupal\lingotek\Plugin\Action\DeleteTranslationLingotekAction
- 3.1.x src/Plugin/Action/DeleteTranslationLingotekAction.php \Drupal\lingotek\Plugin\Action\DeleteTranslationLingotekAction
- 3.2.x src/Plugin/Action/DeleteTranslationLingotekAction.php \Drupal\lingotek\Plugin\Action\DeleteTranslationLingotekAction
- 3.3.x src/Plugin/Action/DeleteTranslationLingotekAction.php \Drupal\lingotek\Plugin\Action\DeleteTranslationLingotekAction
- 3.4.x src/Plugin/Action/DeleteTranslationLingotekAction.php \Drupal\lingotek\Plugin\Action\DeleteTranslationLingotekAction
- 3.5.x src/Plugin/Action/DeleteTranslationLingotekAction.php \Drupal\lingotek\Plugin\Action\DeleteTranslationLingotekAction
- 3.7.x src/Plugin/Action/DeleteTranslationLingotekAction.php \Drupal\lingotek\Plugin\Action\DeleteTranslationLingotekAction
- 3.8.x src/Plugin/Action/DeleteTranslationLingotekAction.php \Drupal\lingotek\Plugin\Action\DeleteTranslationLingotekAction
Delete Lingotek translation of a content entity for one language.
Plugin annotation
@Action(
id = "entity:lingotek_delete_translation_action",
action_label = @Translation("Delete @entity_label translation for @language"),
category = "Lingotek",
deriver = "Drupal\lingotek\Plugin\Action\Derivative\ContentEntityLingotekActionDeriver",
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\Core\Action\ActionBase implements ActionInterface
- class \Drupal\Core\Action\ConfigurableActionBase implements ConfigurableInterface, DependentPluginInterface, PluginFormInterface
- class \Drupal\lingotek\Plugin\Action\LingotekContentEntityConfigurableActionBase implements ContainerFactoryPluginInterface
- class \Drupal\lingotek\Plugin\Action\DeleteTranslationLingotekAction
- class \Drupal\lingotek\Plugin\Action\LingotekContentEntityConfigurableActionBase implements ContainerFactoryPluginInterface
- class \Drupal\Core\Action\ConfigurableActionBase implements ConfigurableInterface, DependentPluginInterface, PluginFormInterface
- class \Drupal\Core\Action\ActionBase implements ActionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of DeleteTranslationLingotekAction
1 file declares its use of DeleteTranslationLingotekAction
- ContentEntityLingotekActionDeriver.php in src/
Plugin/ Action/ Derivative/ ContentEntityLingotekActionDeriver.php
File
- src/
Plugin/ Action/ DeleteTranslationLingotekAction.php, line 15
Namespace
Drupal\lingotek\Plugin\ActionView source
class DeleteTranslationLingotekAction extends LingotekContentEntityConfigurableActionBase {
/**
* {@inheritdoc}
*/
public function executeMultiple(array $entities) {
$entityInfo = [];
$configuration = $this
->getConfiguration();
$langcode = $configuration['language'];
foreach ($entities as $entity) {
$source_language = $entity
->getUntranslated()
->language();
if ($source_language
->getId() !== $langcode && $entity
->hasTranslation($langcode)) {
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entityInfo[$entity
->id()][$langcode] = $langcode;
}
}
\Drupal::getContainer()
->get('tempstore.private')
->get('entity_delete_multiple_confirm')
->set(\Drupal::currentUser()
->id() . ':node', $entityInfo);
if (empty($entityInfo)) {
$this
->messenger()
->addWarning("No valid translations for deletion.");
}
}
/**
* {@inheritdoc}
*/
public function execute($entity = NULL) {
$this
->executeMultiple([
$entity,
]);
}
}