lenoir Posted November 1, 2023 Posted November 1, 2023 I need to display a datetime field next to the title of the page on the tree list. I've used the following code in the ready.php file previously, but it's not working anymore. Also, I'm looking at displaying the date on the tree, not in the search. Am I doing something wrong? Unfortunately I'm not familiar with hooks… $wire->addHookBefore('ProcessPageSearchLive::execute', function(HookEvent $event) { $event->wire()->addHookAfter('FieldtypePageTitle::wakeupValue', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'event') { $suffix = $page->datum; $event->return .= ", {$suffix}"; } }); });
BitPoet Posted November 1, 2023 Posted November 1, 2023 It should be enough to hook "ProcessPageListRender::getPageLabel", no secondary hook necessary. $wire->addHookAfter('ProcessPageListRender::getPageLabel', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'event') { $suffix = $page->datum; $event->return .= ", {$suffix}"; } });
ngrmm Posted November 1, 2023 Posted November 1, 2023 @lenoir you could also use the builtin option in the backend here: setup > templates > your-template > advanced > List of fields to display in the admin Page List 5
lenoir Posted November 1, 2023 Author Posted November 1, 2023 1 hour ago, ngrmm said: @lenoir you could also use the builtin option in the backend here: setup > templates > your-template > advanced > List of fields to display in the admin Page List Ooh… i didn't know about these settings! Thanks a lot, that's exactly what I needed…
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now