vendor\project-biz\portal-bundle\src\Twig\CustomNotificationExtension.php line 28

Open in your IDE?
  1. <?php
  2. namespace ProjectBiz\PortalBundle\Twig;
  3. use Symfony\Component\DependencyInjection\Container;
  4. use Twig\Extension\AbstractExtension;
  5. use Twig\TwigFunction;
  6. /**
  7.  * Extension to retrieve custom notification data as json into js code.
  8.  */
  9. class CustomNotificationExtension extends AbstractExtension
  10. {
  11.     protected $container;
  12.     public function __construct(Container $container)
  13.     {
  14.         $this->container $container;
  15.     }
  16.     public function getFunctions()
  17.     {
  18.         return [
  19.             new TwigFunction('custom_notifications', [$this'CustomNotifications'], ['is_safe' => ['html']]),
  20.         ];
  21.     }
  22.     public function CustomNotifications()
  23.     {
  24.         return $this->container->get('project_biz.notifications_helper')->getCustomNotifications();
  25.     }
  26.     public function getName()
  27.     {
  28.         return 'custom_notification_extension';
  29.     }
  30. }