tires Posted February 9, 2021 Share Posted February 9, 2021 Hi! I inserted {name} {modified} in the field "List of fields that is displayed in the page list at backend" (in german "Liste der Felder, die in der Seitenliste im Admin-Bereich angezeigt werden") at advanced tab in the template settings. The page are now displayed as: mypage 123 1598443140 What do i have to insert to get a formatted date like 9.2.2021? Thanks! Link to comment Share on other sites More sharing options...
BillH Posted February 10, 2021 Share Posted February 10, 2021 One approach would be to use a hook in ready.php, adapting the method described in this post: You'd probably end up with something like this (not tested): wire()->addHookAfter('ProcessPageListRender::getPageLabel', function($event) { $page = $event->arguments('page'); $modifiedFormatted = date("j.n.Y", $page->modified); $event->return = $event->return . ' ' . $modifiedFormatted; }); 3 Link to comment Share on other sites More sharing options...
tires Posted February 10, 2021 Author Share Posted February 10, 2021 Ok. So it is not intended to do this in the template settings? Link to comment Share on other sites More sharing options...
BillH Posted February 13, 2021 Share Posted February 13, 2021 I don't know of a way to do this with the template settings. However, if you want to the date to appear for only a particular template, you could add a check like this: wire()->addHookAfter('ProcessPageListRender::getPageLabel', function($event) { $page = $event->arguments('page'); // Check template if($page->template->name == 'relevant-template') { $modifiedFormatted = date("j.n.Y", $page->modified); $event->return = $event->return . ' ' . $modifiedFormatted; } }); Link to comment Share on other sites More sharing options...
Robin S Posted February 13, 2021 Share Posted February 13, 2021 On 2/11/2021 at 9:28 AM, tires said: So it is not intended to do this in the template settings? The AdminOnSteroids module has a feature that allows formatted dates in Page List via the template settings. See the "Date filter" section in the documentation here. 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