src/Controller/Frontend/BaseFrontendController.php line 30

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Frontend;
  3. use App\Controller\Backend\BaseController;
  4. use Sonata\SeoBundle\Seo\SeoPageInterface;
  5. class BaseFrontendController extends BaseController
  6. {
  7.     public static function getSubscribedServices(): array
  8.     {
  9.         return array_merge(
  10.             parent::getSubscribedServices(), [
  11.             'sonata.seo.page' => SeoPageInterface::class,
  12.         ]);
  13.     }
  14.     public function addTitle($title)
  15.     {
  16.         $this->container->get('sonata.seo.page')
  17.             ->addTitle($title);
  18.     }
  19.     public function setTitle($title)
  20.     {
  21.         $this->container->get('sonata.seo.page')
  22.             ->setTitle($title);
  23.     }
  24.     public function setDescription($description)
  25.     {
  26.         $this->container->get('sonata.seo.page')
  27.             ->addMeta('name''description'$description);
  28.     }
  29.     public function addMeta($type$name$content)
  30.     {
  31.         $this->container->get('sonata.seo.page')
  32.             ->addMeta($type$name$content);
  33.     }
  34. }