I'm trying to make some fields unavailable for a certain user group when they create or edit a new entry. These fields should only be available to admin users. I had implemented this by extending the craft\services\Fields class and using the getFieldsByLayoutId method, checking the user and unsetting the fields which should not be available for the specific user group. This used to work but after some craftcms updates it seems to break the application. Any ideas on how I should approach this?
1 Answer
This should be easy to do w/ the upcoming Craft 4.0 release, via conditional fields.
For Craft 3.x, the cleanest solution is probably to hide the relevant fields with CSS. Combining the CP Body Classes and CP CSS plugin should make this fairly simple.