0

I have used a taxonomy entity reference to fill the values of a select form field. Based on the user roles, I want to limit the options between Submitted, Reviewed, Accepted, and Rejected.

I have used a content type to submit ideas. The field idea status is disabled for a subscriber role and available for moderator role and approver role. I want the Moderator to get the status Reviewed and Rejected. Approver should see Accepted and Rejected status.

How can I achieve this?

  • need more info: is this a custom form and if so can you add the code – longboardnode Apr 5 '18 at 4:17
  • @longboardnode This is a content type to submit ideas. The field "idea status" is disabled for a subscriber role and available for moderator role and approver role. I want the moderator to get the status Reviewed and Rejected. Approver should see Accepted and Rejected. – Rony Samuel Apr 5 '18 at 5:07
0

The options can be hidden by a one liner code,

unset($form['field_name']['und']['#options'][1]);

where

['field_name'] is the name of the your field

[1] is the index of the option in the list

In my case [1] is Submitted, [2] is Reviewed, [3] is Accepted and [4] is Rejected

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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