</header>
{/capture}
+{capture assign='headContent'}
+ {if $article->isMultilingual}
+ {foreach from=$article->getLanguageLinks() item='langArticleContent'}
+ {if $langArticleContent->getLanguage()}
+ <link rel="alternate" hreflang="{$langArticleContent->getLanguage()->languageCode}" href="{$langArticleContent->getLink()}" />
+ {/if}
+ {/foreach}
+ {/if}
+{/capture}
+
{include file='header'}
{if $articleContent->getImage()}
<ul class="articleLikeButtons buttonGroup"></ul>
+ {if $article->isMultilingual}
+ {foreach from=$article->getLanguageLinks() item='langArticleContent'}
+ {if $langArticleContent->getLanguage() && $langArticleContent->languageID != $articleContent->languageID}
+ <a href="{$langArticleContent->getLink()}">{$langArticleContent->getLanguage()->languageName}</a>
+ {/if}
+ {/foreach}
+ {/if}
+
{if ENABLE_SHARE_BUTTONS}
<section class="section jsOnly">
<h2 class="sectionTitle">{lang}wcf.message.share{/lang}</h2>
*/
public $articleContent;
+ /**
+ * language links
+ * @var ArticleContent[]
+ */
+ public $languageLinks;
+
/**
* article's category
* @var ArticleCategory
return $this->articleContent;
}
+ /**
+ * Returns the article's language links.
+ *
+ * @return ArticleContent[]
+ */
+ public function getLanguageLinks() {
+ if ($this->languageLinks === null) {
+ $this->languageLinks = [];
+ $sql = "SELECT articleContentID, title, languageID
+ FROM wcf" . WCF_N . "_article_content
+ WHERE articleID = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute([$this->articleID]);
+ while ($row = $statement->fetchArray()) {
+ $this->languageLinks[($row['languageID'] ?: 0)] = new ArticleContent(null, $row);
+ }
+ }
+
+ return $this->languageLinks;
+ }
+
/**
* Returns the category of the article.
*
use wcf\data\article\Article;
use wcf\data\DatabaseObject;
use wcf\data\ILinkableObject;
+use wcf\data\language\Language;
use wcf\system\html\output\HtmlOutputProcessor;
+use wcf\system\language\LanguageFactory;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
use wcf\system\request\IRouteController;
use wcf\system\request\LinkHandler;
return $this->article;
}
+ /**
+ * Returns the language of this article content as language object.
+ *
+ * @return Language|null
+ */
+ public function getLanguage() {
+ if ($this->languageID) {
+ return LanguageFactory::getInstance()->getLanguage($this->languageID);
+ }
+
+ return null;
+ }
+
public static function getArticleContent($articleID, $languageID) {
if ($languageID !== null) {
$sql = "SELECT *