hellomoto Posted July 10, 2020 Share Posted July 10, 2020 function customPageSaver(HookEvent $hook) { $page = $hook->arguments(0); if ($page->template->name == 'event_instance' && $page->id !== 0) { $page->setOutputFormatting(false); $page->name = wire()->sanitizer->pageName(wireDate('Y-m-d', $page->date)); if ($page->time_end < $page->time_start) { $hook->message('End AFTER starting.'); $page->time_end = ''; } } } $this->addHookAfter('Pages::saveReady(template=event_instance)', null, 'customPageSaver'); -- site/ready.php Can I set the $page->time_end to its previous value, rather than ''? I think I've done that before but forget how. Link to comment Share on other sites More sharing options...
kongondo Posted July 11, 2020 Share Posted July 11, 2020 16 hours ago, hellomoto said: Can I set the $page->time_end to its previous value, rather than ''? I think I've done that before but forget how. This old thread should get you started. However, I am not sure how you would be able to get the current value of the start time to compare against. Link to comment Share on other sites More sharing options...
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