Drupal Association members fund grants that make connections all over the world.
Currently, if a user does not have create grants for a term, then that term is disabled in term reference fields on the entity edit form. There are a couple issues with this approach:
- Having any form element the user cannot select is a usability no-no (per Bojhan).
- Since terms are only disabled and never hidden, all fields will list all values, which makes forms larger and more confusing.
Other possible behaviors are to hide some or all of the terms. Hiding all of the disallowed terms is most consistent, but has the following issues:
- The apparent taxonomy hierarchy is garbled whenever a parent term is disabled, but its child is not.
- Some sites use parent-level taxonomy terms as category labels for child terms.
- This method would break dependent dropdown-type widgets if a parent term is disallowed.
- The user might not realize there are terms he or she cannot control, or be confused that terms he or she sees listed elsewhere are not listed on the edit form.
Hiding all terms except those needed to maintain a meaningful hierarchy is probably the most desirable behavior. However, it has the following issues:
- It is actually complicated to calculate which disabled terms to show and which to hide, in part of taxonomy API limitations (see ), and it adds overhead, especially for large taxonomies.
- Having some disabled terms visible and others hidden might be even more confusing than anything else.
- This method re-introduces the problem of non-usable form elements.
- This method would be the most difficult to degrade gracefully (see ).
I experimented with the third option a bit, and there are technical considerations in addition to the usability question. This method did not work well with non-core widgets (Multiselect was buggy and Hierarchical Select did not work at all). Furthermore, simply applying the jQuery
.hide() method to the elements left checkbox labels displayed, and multiselect boxes were not resized (so 2 or 3 terms were visible in a page-long box). More advanced jQuery would be needed.
In either the first case or the third, there should be better visual presentation for disabled elements. Browser CSS support for select options is, unfortunately, limited and inconsistent. However, we could at least provide a class on labels for disabled checkboxes/radios to make it more obvious that they are uneditable.
Another possibility would be to provide configuration allowing the administrator to choose which method is used, either globally or on a per-instance basis.