mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 06:03:39 +08:00
Add back defaults for language and direction attributes (#1860)
This commit is contained in:
parent
14e89546ca
commit
db7e28d316
|
@ -10,13 +10,30 @@
|
||||||
namespace Flarum\Frontend\Content;
|
namespace Flarum\Frontend\Content;
|
||||||
|
|
||||||
use Flarum\Frontend\Document;
|
use Flarum\Frontend\Document;
|
||||||
|
use Flarum\Locale\LocaleManager;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
class Meta
|
class Meta
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var LocaleManager
|
||||||
|
*/
|
||||||
|
private $locales;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param LocaleManager $locales
|
||||||
|
*/
|
||||||
|
public function __construct(LocaleManager $locales)
|
||||||
|
{
|
||||||
|
$this->locales = $locales;
|
||||||
|
}
|
||||||
|
|
||||||
public function __invoke(Document $document, Request $request)
|
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->meta = array_merge($document->meta, $this->buildMeta($document));
|
||||||
$document->head = array_merge($document->head, $this->buildHead($document));
|
$document->head = array_merge($document->head, $this->buildHead($document));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user