I think Craft would be more awesome and more handsome if it allowed me to mark some fields as read-only. just a small checkbox in the field's settings š½
Thereās a plugin for it https://plugins.craftcms.com/incognito-field
@Sam-Black-0013 Is that plugin relatively similar to what youāre looking for?
Yub it is, thanks. But can't it be added as a core feature in fields ?
@Sam-Black-0013 Just making sure weāre on the same page. There are lots of similar enhancements planned for Craft 4.0 so I will make a note of this for that.
AWW @brandonkelly u guys are the best >.<
I would find it handy if there could be readonly setting on fields by user roles. Like if admins/devs could edit the field from the CMS without changing the field type from readonly to editable, but it would always be readonly for everyone else.
Craft 3.5 has a new field layout designer, which includes the ability to add additional UI elements, including one that pulls in a site template of your choosing. So you can use that to put whatever arbitrary HTML you want in your field layout, which Iād say resolves this.
Brandon, I think you misunderstood the feature request. The idea is to be able to configure regular fieldsā visibility on edit pages. Ideally this would work with every field type, and configuration would be per field layout.
The Incognito field plugin solves this for plain text fields only. Visibility can be configured dynamically using Twig.
{{ currentUser.isInGroup('editors') ? 'readonly' : 'hidden' }}
https://github.com/mmikkel/IncognitoField-Craft3#overriding-the-rendering-mode-with-twig-logic
There hasnāt been any mention of toggling field _visibility_ here, just _writability_. Toggling field visibility based on user groups is covered by #947.
I interpreted the issue as requesting a _field-level_ āRead-onlyā checkbox āĀ not something that could sometimes be writable, sometimes not, depending on a condition. At which point, it would be better to just not have a field in the first place, and use a Template UI element in the field layout. But can reopen if I was mistaken.
Ah ok, thatās how you read it! I donāt see the purpose of a field thatās not writeable at all, so I assumed the issue is about its rendering in the control panel. Content would be written to it in other ways, from front end forms, or programatically.
I donāt see the purpose of a field thatās not writeable at all
Yeah good point. Iāll go ahead and reopen on the assumption that the request is for _sometimes_-read-only fields.
Most helpful comment
AWW @brandonkelly u guys are the best >.<