You are here

README.txt in Reference field option limit 7

Reference options limit module
==============================

This module allows reference fields of several types to have their available
options limited by the values of other fields in the current entity.

Requirements
------------

- Drupal core 7.8 or higher, due to our use of hook_field_widget_form_alter().

Example
-------

Suppose you want news stories to be marked as being about a sport and a
particular team for that sport, perhaps using taxonomy terms for both.

To make editing easier, you would probably like want the 'team' dropdown to
be limited to just teams for the current news story's sport.

To achieve this with this module, add the 'sport' field to both news story 
nodes and team taxonomy terms. Hence the team 'Chudley Cannons' would have
as its team taxonomy term 'Quidditch'.

(This probably entails taxonomy term reference fields on terms
themselves... which was bound to happen with FieldAPI sooner or later.)

Thus, when editing a news story node, selecting 'Quidditch' as the sport
will cause the team reference field to update to show only teams which
also have Quidditch' as their* sport.

Setup
-----

Suppose:
- the option limited field (i.e. the field you want to limit) is on
  entity type A.
- this field points to (i.e., refers to) entities of type B.

1. Add your entity reference field on entity type A as normal. This will be the
  option limited field.
2. Add a field to entity type A whose values will be used to limit the option
  limited field.
3. Add the *same field* to entity type B.
4. Return to the option limited field settings and select field B as your
  matching field.

Terminology
-----------

- option limited field: a field whose type is some sort of reference, whose
   reference options we limit with this module.
- matching field: a field whose values we use to limit the options in an
   option limited field. We do this by requiring that the field be applied
   to both:
   - the entity bundle that bears the option limited field itself
   - the entity bundle(s) that the option limited field may refer to

File

README.txt
View source
  1. Reference options limit module
  2. ==============================
  3. This module allows reference fields of several types to have their available
  4. options limited by the values of other fields in the current entity.
  5. Requirements
  6. ------------
  7. - Drupal core 7.8 or higher, due to our use of hook_field_widget_form_alter().
  8. Example
  9. -------
  10. Suppose you want news stories to be marked as being about a sport and a
  11. particular team for that sport, perhaps using taxonomy terms for both.
  12. To make editing easier, you would probably like want the 'team' dropdown to
  13. be limited to just teams for the current news story's sport.
  14. To achieve this with this module, add the 'sport' field to both news story
  15. nodes and team taxonomy terms. Hence the team 'Chudley Cannons' would have
  16. as its team taxonomy term 'Quidditch'.
  17. (This probably entails taxonomy term reference fields on terms
  18. themselves... which was bound to happen with FieldAPI sooner or later.)
  19. Thus, when editing a news story node, selecting 'Quidditch' as the sport
  20. will cause the team reference field to update to show only teams which
  21. also have Quidditch' as their* sport.
  22. Setup
  23. -----
  24. Suppose:
  25. - the option limited field (i.e. the field you want to limit) is on
  26. entity type A.
  27. - this field points to (i.e., refers to) entities of type B.
  28. 1. Add your entity reference field on entity type A as normal. This will be the
  29. option limited field.
  30. 2. Add a field to entity type A whose values will be used to limit the option
  31. limited field.
  32. 3. Add the *same field* to entity type B.
  33. 4. Return to the option limited field settings and select field B as your
  34. matching field.
  35. Terminology
  36. -----------
  37. - option limited field: a field whose type is some sort of reference, whose
  38. reference options we limit with this module.
  39. - matching field: a field whose values we use to limit the options in an
  40. option limited field. We do this by requiring that the field be applied
  41. to both:
  42. - the entity bundle that bears the option limited field itself
  43. - the entity bundle(s) that the option limited field may refer to