OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.38k stars 1.12k forks source link

Display option override in DateTimeField #8728

Open AgostiniAlessandro opened 1 year ago

AgostiniAlessandro commented 1 year ago

Right now it’s possibile to configure a DateTimeField so that it allows the user to specify only the Date, only the Time or both. In some cases it would be useful to allow the user to override this setting for a specific content.

For example and Event content type may contain a DateTimeField representing its starting date/time so in the field's Display option will be set to DateTime in content definition but the user may want to only show the starting date for a particular event and right now this is not possible. By allowing the user to override the Display option value in the content we allow him to decide wether he wants the starting date or time to be shown for a particular event without having to modify the setting for the other contents of the same type.

sebastienros commented 1 year ago

I think this should be a different field on the content type that would drive how the content is rendered. Otherwise we would provide all the field options to all content items.

Here just add "Display Time" as a boolean field, and use it in your theme/template to decide how to render it.

BenedekFarkas commented 7 months ago

Here just add "Display Time" as a boolean field, and use it in your theme/template to decide how to render it.

You're saying that this should only be a type-level, but not item-level setting, right?

BenedekFarkas commented 1 week ago

@sebastienros I tested this (including my suggested changes under the PR) and seems to work correctly. I don't mind adding this, since it's opt-in.

sebastienros commented 5 days ago

I still think this should be a custom field on this type. You can still set the setting at the part level. You add an emumartion field to your types, and use this field to drive the UI in the template of this type. One template to update to get the same result.

The other thing we discussed is that if we'd be to accept it we would then accept it also for any setting of any fields.