function views_process_dependency
Process callback to add dependency to form items.
Usage:
On any form item, add
'#process' => 'views_process_dependency'
'#dependency' => array('id-of-form-without-the-#' => array(list, of, values, that, make, this, gadget, visible));
28 string references to 'views_process_dependency'
- views_handler_argument::default_argument_form in handlers/
views_handler_argument.inc - Provide a form for selecting the default argument when the default action is set to provide default argument.
- views_handler_argument::options_form in handlers/
views_handler_argument.inc - views_handler_argument_string::options_form in handlers/
views_handler_argument_string.inc - views_handler_argument_term_node_tid_depth::options_form in modules/
taxonomy/ views_handler_argument_term_node_tid_depth.inc - views_handler_field::options_form in handlers/
views_handler_field.inc - Default options form that provides the label widget that all fields should have.
File
-
includes/
form.inc, line 265
Code
function views_process_dependency($element, $edit, &$form_state, &$form) {
static $dependencies;
if (isset($element['#dependency']) && !isset($dependencies[$element['#id']])) {
if (!isset($element['#dependency_count'])) {
$element['#dependency_count'] = 1;
}
if (!empty($form_state['ajax'])) {
$form_state['js settings']['viewsAjax']['formRelationships'][$element['#id']] = array(
'num' => $element['#dependency_count'],
'values' => $element['#dependency'],
);
}
else {
views_add_js('dependent');
$options['viewsAjax']['formRelationships'][$element['#id']] = array(
'num' => $element['#dependency_count'],
'values' => $element['#dependency'],
);
drupal_add_js($options, 'setting');
}
$dependencies[$element['#id']] = TRUE;
}
return $element;
}