<?php
namespace App\Controller\Frontend;
use App\Controller\Backend\BaseController;
use Sonata\SeoBundle\Seo\SeoPageInterface;
class BaseFrontendController extends BaseController
{
public static function getSubscribedServices(): array
{
return array_merge(
parent::getSubscribedServices(), [
'sonata.seo.page' => SeoPageInterface::class,
]);
}
public function addTitle($title)
{
$this->container->get('sonata.seo.page')
->addTitle($title);
}
public function setTitle($title)
{
$this->container->get('sonata.seo.page')
->setTitle($title);
}
public function setDescription($description)
{
$this->container->get('sonata.seo.page')
->addMeta('name', 'description', $description);
}
public function addMeta($type, $name, $content)
{
$this->container->get('sonata.seo.page')
->addMeta($type, $name, $content);
}
}