function Media::postSave
Overrides ContentEntityBase::postSave
File
-
core/
modules/ media/ src/ Entity/ Media.php, line 384
Class
- Media
- Defines the media entity class.
Namespace
Drupal\media\EntityCode
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update);
$is_new = !$update;
foreach ($this->translations as $langcode => $data) {
if ($this->hasTranslation($langcode)) {
$translation = $this->getTranslation($langcode);
if ($translation->bundle->entity
->thumbnailDownloadsAreQueued() && $translation->shouldUpdateThumbnail($is_new)) {
\Drupal::queue('media_entity_thumbnail')->createItem([
'id' => $translation->id(),
]);
}
}
}
}