Search the Community
Showing results for tags 'non autoload'.
-
Hello, I have a hook in a custom method of a non autoload module and it is not calling my hook method. In the wiki I read Modules that are intended to attach hooks in the application typically should be autoload because they listen in to classes rather than have classes call upon them. If they weren't autoload, then they might never get to attach their hooks. Does this mean that hooks are only working in autoload modules? I added 'singular' => true and 'autoload' => true to getModuleInfo() but still my hook funktion does not get called. My hook call at the end of this render method $this->inlineScript = $inlineScript; $page->addHookAfter('render', $this, 'addInlineScript'); $page object is available. Also tried $this->addHookAfter('Page::render', $this, 'addInlineScript'); and my hook method public function addInlineScript($event) { exit("gbr"); // $value contains the full rendered markup of a $page $value = $event->return; $value = str_replace("</body>", $this->inlineScript . "</body>", $value); // set the modified value back to the return value $event->return = $value; } Why is this not working? Any help would be much appreciated.
- 14 replies
-
- hook
- non autoload
-
(and 1 more)
Tagged with: