Hi all, I am writing a module which should be able to add content to the body of any view of a site. So I have attached a listener to the view.layout event :
public function attachListeners(SharedEventManagerInterface $sharedEventManager) {
$sharedEventManager->attach('*', 'view.layout', [$this, 'hookViewLayout']);
}
Then in my “hook” function, I want to inject custom content to the body of the view:
public function hookViewLayout(Event $event)
{
$services = $this->getServiceLocator();
if (!$services->get('Omeka\Status')->isSiteRequest()) {
return;
}
$view = $event->getTarget();
// inject custom content
}
Reading the Laminas View documentation, I could not find a way to do that. Could someone point me in the right direction please?
Hi again, I understand there are more questions than answers, but I am quite sure someone else has already solved this problem or even has an idea about how to solve it