- // only add the tag on the entry if the relation doesn't exist
- if (false === $entry->getTags()->contains($tagEntity)) {
- $entry->addTag($tagEntity);
- }
+ if (!empty($content['language'])) {
+ $this->updateLanguage($entry, $content['language']);
+ }
+
+ if (!empty($content['open_graph']['og_image'])) {
+ $this->updatePreviewPicture($entry, $content['open_graph']['og_image']);
+ }
+
+ // if content is an image, define it as a preview too
+ if (!empty($content['content_type']) && \in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) {
+ $this->updatePreviewPicture($entry, $content['url']);
+ }
+
+ if (!empty($content['content_type'])) {
+ $entry->setMimetype($content['content_type']);
+ }
+
+ try {
+ $this->tagger->tag($entry);
+ } catch (\Exception $e) {
+ $this->logger->error('Error while trying to automatically tag an entry.', [
+ 'entry_url' => $content['url'],
+ 'error_msg' => $e->getMessage(),
+ ]);