diff --git a/src/EventSubscriber/TwigEventSubscriber.php b/src/EventSubscriber/TwigEventSubscriber.php new file mode 100644 index 0000000..e567055 --- /dev/null +++ b/src/EventSubscriber/TwigEventSubscriber.php @@ -0,0 +1,32 @@ +twig = $twig; + $this->conferenceRepository = $conferenceRepository; + } + + public function onControllerEvent(ControllerEvent $event): void + { + $this->twig->addGlobal('conferences', $this->conferenceRepository->findAll()); + } + + public static function getSubscribedEvents(): array + { + return [ + ControllerEvent::class => 'onControllerEvent', + ]; + } +} diff --git a/templates/base.html.twig b/templates/base.html.twig index 3cda30f..7a2838c 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -12,6 +12,15 @@ {% endblock %} +
+

Guestbook

+ +
+
{% block body %}{% endblock %}