Kirby 2's override field option for datetime fields - create an idea on Github?

Hello,

I have a datetime field which is hiden, required and disabled in my default.yml blueprint. The default value is now. This field works as expected in new page drafts. Sadly, I require this field for Home and Error page because this field is used on any page - it’s like the last change timestamp of the page. Now I face the issue that I can’t do changes to the Home and Error page because the page was created in the past and thus misses this required data. According to this forum, I could use the old Kirby 2 way: override: true to always apply the current date and time. This solution still works but only for date fields without time, although according to some post in the forum this feature hasn’t been ported to Kirby 3. So if I would like to know if I should create a idea issue on Github to get an official doc for the override field and its functionality extended to support datetime fields. I dislike to write a hook for this and relying on the file system for the last change timestamp of the page/content is a bad idea because it can be wrong in some cases.

Not sure if this is something I should ask for in the forum nor if I did understand the situation but at least this seems to be quite cheap to extend the override feature and then we got an improved Kirby 3 feature.

Best Regards,

But you can already extend and override a fields settings, so for those two pages you can remove the required status…

https://getkirby.com/docs/guide/blueprints/extending-blueprints#reusing-and-extending-single-fields

You could still use a hook, without using the file system timestamp. Just update the field with the current datetime within page.update:after

Thanks for remembering me regarding the extending feature. In this case it doesn’t fit because the field has to be required to prevent missing important meta data for a page due to forgetting to setting it or because it gets altered. It should be filled in any case.

Yep, that’s the best solution at the moment but at the end, I implement a very basic feature via a plugin with a hook for each project although I will need this in different projects. To me, it is a big overload to implement a hook just to have this field working; although it isn’t a rare or special requirement.

Default values only work at page creation in Kirby 3. You would have to create a feature request issue for this.

As an alternative, you could try and create a simple custom field with a save method that stores the current timestamp on save.

@warg Could you give me an example of a working override in Kirby 3? I can’t find anything in the source code.

You are right :frowning: . Seems like I have tested this the wrong way when I posted about this. I was surprised that it worked because I didn’t find any docs and code too but I thought that I maybe just missed the correct spot because I searched badly in the source code. I will edit the post on the Github idea repo to clarify that it’s not implemented anymore.