if ($articleContent->hasEmbeddedObjects) {
$embeddedObjectPostIDs[] = $articleContent->articleContentID;
}
+
+ $articleIDs[] = $articleContent->articleID;
}
+ $contentLanguageID = null;
+ if (count($this->objects) === 1) {
+ $contentLanguageID = reset($this->objects)->languageID;
+ }
+
// cache images
if (!empty($imageIDs)) {
- $mediaList = new ViewableMediaList();
+ $mediaList = new ViewableMediaList($contentLanguageID);
$mediaList->setObjectIDs($imageIDs);
$mediaList->readObjects();
$images = $mediaList->getObjects();
-
- foreach ($this->getObjects() as $articleContent) {
+ }
+
+ // load embedded objects
+ if (!empty($embeddedObjectPostIDs)) {
- $contentLanguageID = null;
- if (count($embeddedObjectPostIDs) === 1) $contentLanguageID = reset($this->objects)->languageID;
-
+ MessageEmbeddedObjectManager::getInstance()->loadObjects('com.woltlab.wcf.article.content', $embeddedObjectPostIDs, $contentLanguageID);
+ }
+
+ if (!empty($articleIDs)) {
+ $articleList = new ViewableArticleList();
+ // to prevent an infinity loop, because the list loads otherwise the article content
+ $articleList->enableContentLoading(false);
+ $articleList->setObjectIDs($articleIDs);
+ $articleList->readObjects();
+ }
+
+ foreach ($this->getObjects() as $articleContent) {
+ if (isset($images)) {
if ($articleContent->imageID && isset($images[$articleContent->imageID])) {
$articleContent->setImage($images[$articleContent->imageID]);
}