From fb45773ecb986ffe1aabce2e5d5c77ed62a2e2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sevilla=20Mart=C3=ADn?= Date: Thu, 5 Sep 2019 02:28:52 -0400 Subject: [PATCH] Add back defaults for language and direction attributes (#1860) --- framework/core/src/Frontend/Content/Meta.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/framework/core/src/Frontend/Content/Meta.php b/framework/core/src/Frontend/Content/Meta.php index 4f307a15f..06e19bd7a 100644 --- a/framework/core/src/Frontend/Content/Meta.php +++ b/framework/core/src/Frontend/Content/Meta.php @@ -12,13 +12,30 @@ namespace Flarum\Frontend\Content; use Flarum\Frontend\Document; +use Flarum\Locale\LocaleManager; use Illuminate\Support\Arr; use Psr\Http\Message\ServerRequestInterface as Request; class Meta { + /** + * @var LocaleManager + */ + private $locales; + + /** + * @param LocaleManager $locales + */ + public function __construct(LocaleManager $locales) + { + $this->locales = $locales; + } + public function __invoke(Document $document, Request $request) { + $document->language = $this->locales->getLocale(); + $document->direction = 'ltr'; + $document->meta = array_merge($document->meta, $this->buildMeta($document)); $document->head = array_merge($document->head, $this->buildHead($document)); }