Search the Community
Showing results for tags 'page::render'.
-
Hi folks, i try to use a hook to change some markup inside admin, this hook works fine inside a ready.php file, but its not working inside my module: <?php namespace ProcessWire; class InputfieldPageTableExtendedGrid extends InputfieldPageTable { public static function getModuleInfo() { return array( 'title' => __('Inputfield for PageTableExtendedGrid', __FILE__), // Module Title 'summary' => __('Adds Inputfield for PageTableExtendedGrid', __FILE__), // Module Summary 'version' => 233, 'requires' => array('FieldtypePageTableExtendedGrid'), 'permanent' => false, ); } public function ready() { $this->addHookAfter('Page::render', function($event) { $value = $event->return; // Return Content $style = "<style type='text/css'>". $this->pages->get((int) wire('input')->get('id'))->style ."</style>"; // Add Style inside bottom head $event->return = str_replace("</head>", "\n\t$style</head>", $value); // Return All Changes }); } } whats wrong here?
-
I've written a hook which replaces the page::render method. Based on a few conditions, I might want to output something different from what page::render would return. So when my conditions aren't met, I want to use the return value of the original page::render method. How can I do this? At the moment I've got something like this: function pageRenderHookMethod (HookEvent $event) { if ('my condition' == true) { $event->replace = true; $event->return = 'my custom return value'; } else { $event->return = 'original return value of page::render'; } } But I don't know how to get the original return value of page::render because the would trigger my hooked method instead of the original method.
-
How can I change the output of `Page::render`? I've created a hook before page::render, but when I set the $event->return to something else, my whole page is replaced with that value. For example: public function beforePageRender(HookEvent $event) { $event->return = 'blaat'; } This will cause my whole page to be nothing more than just 'blaat'. What I want, is that my menu, footer etc. are still visible but only the content of that page is replaced.
- 10 replies
-
- page::render
- render
- (and 4 more)