protected function ContentEntityStorageBase::invokeTranslationHooks in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::invokeTranslationHooks()
- 10 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::invokeTranslationHooks()
Checks translation statuses and invoke the related hooks if needed.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity being saved.
1 call to ContentEntityStorageBase::invokeTranslationHooks()
- ContentEntityStorageBase::doPostSave in core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php - Performs post save entity processing.
File
- core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php, line 786
Class
- ContentEntityStorageBase
- Base class for content entity storage handlers.
Namespace
Drupal\Core\EntityCode
protected function invokeTranslationHooks(ContentEntityInterface $entity) {
$translations = $entity
->getTranslationLanguages(FALSE);
$original_translations = $entity->original
->getTranslationLanguages(FALSE);
$all_translations = array_keys($translations + $original_translations);
// Notify modules of translation insertion/deletion.
foreach ($all_translations as $langcode) {
if (isset($translations[$langcode]) && !isset($original_translations[$langcode])) {
$this
->invokeHook('translation_insert', $entity
->getTranslation($langcode));
}
elseif (!isset($translations[$langcode]) && isset($original_translations[$langcode])) {
$this
->invokeHook('translation_delete', $entity->original
->getTranslation($langcode));
}
}
}