drupal_process_states(&$elements)Adds JavaScript to the element to allow it to have different active states.
Each of these states is an array containing conditions that must be met in order for this state to be active. The key to this conditioning array is a jQuery selector for the element that is checked. The value of the conditioning array are the states that are checked on the element (empty, checked, value, collapsed, etc) and the expected value of that condition.
<?php
$form['email_canceled']['settings'] = array(
'#type' => 'container',
'#states' => array(
// Hide the settings when the cancel notify checkbox is disabled.
'invisible' => array(
'input[name="email_canceled_toggle"]' => array('checked' => FALSE),
),
),
);
?>
$elements The structured array that may contain an array item named states. This array describes the different JavaScript states that can be applied to the element when certain conditions are met. The #states array is first keyed by one of the following states:
includes/common.inc, line 3864
<?php
function drupal_process_states(&$elements) {
$elements['#attached']['js']['misc/states.js'] = array('weight' => JS_LIBRARY + 1);
$elements['#attached']['js'][] = array(
'type' => 'setting',
'data' => array('states' => array('#' . $elements['#id'] => $elements['#states'])),
);
}
?>