mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Display notification using services (draft)
This commit is contained in:
@@ -55,6 +55,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
||||
$loader->load('services/controller.yaml');
|
||||
$loader->load('services/form.yaml');
|
||||
$loader->load('services/templating.yaml');
|
||||
$loader->load('services/notification.yaml');
|
||||
}
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
|
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\ActivityBundle\Notification;
|
||||
|
||||
use Chill\MainBundle\Entity\Notification;
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
|
||||
final class ActivityNotificationRenderer
|
||||
{
|
||||
public function supports(Notification $notification)
|
||||
{
|
||||
return $notification->getRelatedEntityClass() == Activity::class;
|
||||
}
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
return 'ChillActivityBundle:Activity:showInNotification.html.twig';
|
||||
}
|
||||
|
||||
public function getTemplateData(Notification $notification)
|
||||
{
|
||||
return ['notification' => $notification];
|
||||
}
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
|
||||
{{ dump(notification) }}
|
||||
|
||||
<a href="{{ path('chill_activity_activity_show', {'id': notification.relatedEntityId }) }}">Go to Activity</a>
|
@@ -0,0 +1,3 @@
|
||||
services:
|
||||
Chill\ActivityBundle\Notification\ActivityNotificationRenderer:
|
||||
autowire: true
|
Reference in New Issue
Block a user