<?php
namespace ProjectBiz\PortalBundle\Twig;
use Symfony\Component\DependencyInjection\Container;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
/**
* Extension to retrieve custom notification data as json into js code.
*/
class CustomNotificationExtension extends AbstractExtension
{
protected $container;
public function __construct(Container $container)
{
$this->container = $container;
}
public function getFunctions()
{
return [
new TwigFunction('custom_notifications', [$this, 'CustomNotifications'], ['is_safe' => ['html']]),
];
}
public function CustomNotifications()
{
return $this->container->get('project_biz.notifications_helper')->getCustomNotifications();
}
public function getName()
{
return 'custom_notification_extension';
}
}