array('ctools_dependent_process'), @endcode * - @code '#dependency' => array('id-of-form-without-the-#' => array(list, of, values, that, make, this, gadget, visible)), @endcode */ /** * Process callback to add dependency to form items. */ function ctools_dependent_process($element, $edit, &$form_state, &$form) { if (isset($element['#dependency'])) { if (!isset($element['#dependency_count'])) { $element['#dependency_count'] = 1; } if (!empty($form_state['ajax'])) { $form_state['js settings']['CTools']['dependent'][$element['#id']] = array('num' => $element['#dependency_count'], 'values' => $element['#dependency']); } else { ctools_add_js('dependent'); $options['CTools']['dependent'][$element['#id']] = array('num' => $element['#dependency_count'], 'values' => $element['#dependency']); drupal_add_js($options, 'setting'); } } return $element; }