0

I have Node with taxonomy terms. Example

  • Term A
  • Term B
  • Term C

and user role like this

  • Role 1
  • Role 2
  • Role 3

Using Taxonomy Access Control(TAC) I can limit Role 1 can add all terms, Role 2 only add Term B, Role 3 only add term C.

With CSS I can hide disabled options, so when Role 3 want to add content. ex: Role 3 will only see Term C.

But how can I make Term C autofilled when Role 3 want to add. Right now Role 3 must choose or fill two options, nothing and Term C.

Any ideas?

1

There might be better ways to do it, but this what I did in my case.

  1. In hook_form_alter loop through the '#options' for this field.
  2. Store every item in a new array skipping the one you don't want as options for this field. (in my case it was the item at index 0 with value 'N/A').
  3. Assign this new array of options as '#options' for the field.

Worked for me.

  • Thans @amir0220 – mbahlol Mar 11 '14 at 5:49

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.