statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
31 stars 1 forks source link

Hidden computed fields #940

Open aerni opened 1 year ago

aerni commented 1 year ago

I've got a events computed field in a community collection. I don't want to show this field in the CP. The simple solution is not to add the field to the blueprint, dah. But I still want to make use of field augmentation, which is why I'm adding an events field to the blueprint.

But if I choose visibility: hidden, the value gets saved. And if I choose visibility: computed, the field is shown. It would be great if we had the option to also hide computed fields in the CP.

Maybe visibility: hidden should work like conditional fields and not save values by default. And you can opt-in to saving values with always_save: true. Then we could probably remove the visibility: computed option, as the only difference is that it doesn't save values compared to visibility: hidden. Just an idea.

The simple workaround is to add a field condition in addition to visibility: computed. Something like:

if:
  this_will_never_show: 'equals true'
jesseleite commented 1 year ago

Good use case, but we disagree with changing the functionality, as there are also valid use cases for how it's currently designed as well.

That said, how about if visibility: hidden was intelligent about detecting whether or not it's being used on a computed field?

CleanShot 2023-01-20 at 11 23 50

aerni commented 1 year ago

That should work.

o1y commented 1 year ago

I have a similar use-case, where I just want to show my computed field in the listing only, but not on the publish form. Having visibility: hidden, would save the computed value.