Muut Archive Legend
@Muut · Joined 9 years ago · 18337 posts · 3878 topics · 137 reputation
Badges
Recent posts
-
onTwigPageVariables event handler and modular pages
· 11 years ago
Yup you are correct! I didn't dig deep into how the dispatch handled the event. I'll take a look at the PR. Thanks!
-
onTwigPageVariables event handler and modular pages
· 11 years ago
I submitted a PR for the described patch, see https://github.com/getgrav/grav/pull/386
-
onTwigPageVariables event handler and modular pages
· 11 years ago
@rhukster @hwmaier Is right. You can look at the Symphony EventDispatcher at line 160. For convenience I will post a snippet here: protected function doDispatch($listeners, $eventName, Event $event) {
-
onTwigPageVariables event handler and modular pages
· 11 years ago
No it wouldn't as the passed event argument is then simply ignored.
-
onTwigPageVariables event handler and modular pages
· 11 years ago
Interesting, but this would cause significant backwards compatibility problems for all plugins/themes that have this event method defined without the Event $event in the method signature.
-
onTwigPageVariables event handler and modular pages
· 11 years ago
And then the handler can check like this: public function onTwigPageVariables(Event $event) { $page = $event['page']; $header = $page->header();
-
onTwigPageVariables event handler and modular pages
· 11 years ago
Like in this patch: { $content = $content !== null ? $content : $item->content(); // override the twig header vars for local resolution $this->grav->fireEvent('o
-
onTwigPageVariables event handler and modular pages
· 11 years ago
Yes, that work on template level. But I like to check a modular header from a plugin. I have the feeling the onTwigPageVariables has to change and the page object needs to be passed down.
-
onTwigPageVariables event handler and modular pages
· 11 years ago
the Twig variable page should be associated with the actual page even in modular pages. Just do a: {{ dump(page.title) }} in the Twig of each modular page type and the modular surrounding page, shoul
-
onTwigPageVariables event handler and modular pages
· 11 years ago
Reason I am asking this is that I like to process a modular page's header from within onTwigPageVariables event handler.