2

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
  • Did you find it? I'm facing exact the same problem. Commented Mar 7, 2022 at 11:11

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.