From db7e28d316d44f8ca26eefeeef40989d0f17bbb8 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) --- src/Frontend/Content/Meta.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Frontend/Content/Meta.php b/src/Frontend/Content/Meta.php index 9b9f30d0e..2d0c6dd0e 100644 --- a/src/Frontend/Content/Meta.php +++ b/src/Frontend/Content/Meta.php @@ -10,13 +10,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)); }