Drupal Association members fund grants that make connections all over the world.
This patch adds a generic form dependency system to Drupal. This allows you to specify dependencies of one form element on another in a declarative way like this:
'#dependencies' => array( 'enabled' => array( '#edit-menu-has-menu' => array('checked' => TRUE) ) ),
This dependency specification means: The form element is
enabled when the element with the ID
edit-menu-has-menu is checked. Intuitively, you could also specify
FALSE which results in the opposite behavior.
#edit-menu-has-menu is a CSS selector, that means you can specify arbitrary elements (they don’t have to be FAPI elements). Each state (
checked, …) of form element can depend on an arbitrary number of other elements. The opposite state can be specified by prepending an exclamation mark. States can be aliased, for example,
enabled is just an alias for
!disabled. Recursive aliases are possible.
The system is open and module developers and themers can easily expand the available states and implement their own state handlers. Module developers and themers can override actions for single form elements, e.g. if they want to implement a different way of hiding and showing one particular form element, they can do that.
This is a first draft at this system and not yet complete. However, it’s already in a state where it can be reviewed. Code freeze is next week ;)
|#85||557272-states-selects-D7.patch||473 bytes||Dave Reid|
PASSED: [[SimpleTest]]: [MySQL] 17,380 pass(es). View
|#83||557272-states-selects-D7.patch||445 bytes||Dave Reid|
PASSED: [[SimpleTest]]: [MySQL] 17,383 pass(es). View
Passed: 13885 passes, 0 fails, 0 exceptions View
Passed: 13869 passes, 0 fails, 0 exceptions View
Passed: 13873 passes, 0 fails, 0 exceptions View