Pass additional data to your template using a custom controller =============================================================== Templates include a ``controller`` tag that defines which controller is used for rendering pages of the template. Sulu includes a ``DefaultController`` that resolves the data of the properties of the template and passes it to your twig template. If you want to pass additional data to your twig template, you can configure a custom controller class that provides this data. .. code-block:: xml Inside of your controller implementation, you are free to harness the full power of the Symfony framework. If you want to access a service, you need to implement the ``getSubscribedServices`` method like described in the `Service Subscribers Documentation`_. In most cases, you want your custom controller to extend the functionality of the ``DefaultController`` of Sulu. When extending the ``DefaultController``, you only need to overwrite the ``getAttributes`` method to include the data that should be passed to your twig template. .. code-block:: php get('my_custom_service')->getMyData(); return $attributes; } public static function getSubscribedServices(): array { $subscribedServices = parent::getSubscribedServices(); $subscribedServices['my_custom_service'] = 'your_service_id_or_class'; return $subscribedServices; } } .. _Service Subscribers Documentation: https://symfony.com/doc/current/service_container/service_subscribers_locators.html