namespace Wallabag\CoreBundle\Twig;
+use Doctrine\Common\Collections\Collection;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
+use Wallabag\CoreBundle\Notifications\NotificationInterface;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\CoreBundle\Repository\TagRepository;
use Symfony\Component\Translation\TranslatorInterface;
{
return [
new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']),
+ new \Twig_SimpleFilter('unread_notif', [$this, 'unreadNotif']),
];
}
return preg_replace('/^www\./i', '', $url);
}
+ public function unreadNotif(Collection $notifs)
+ {
+ return $notifs->filter(function(NotificationInterface $notif) {
+ return !$notif->isRead();
+ });
+ }
+
/**
* Return number of entries depending of the type (unread, archive, starred or all).
*