function formblock_dependent_process in Form Block 6
Process callback to add dependency to form items.
1 string reference to 'formblock_dependent_process'
- formblock_form_alter in ./
formblock.module - Implementation of hook_form_alter().
File
- ./
formblock.module, line 141
Code
function formblock_dependent_process($element, $edit, &$form_state, &$form) {
if (isset($element['#dependency'])) {
if (!isset($element['#dependency_count'])) {
$element['#dependency_count'] = 1;
}
if (!isset($element['#dependency_type'])) {
$element['#dependency_type'] = 'hide';
}
$js = array(
'values' => $element['#dependency'],
'num' => $element['#dependency_count'],
'type' => $element['#dependency_type'],
);
if (!empty($form_state['ajax'])) {
$form_state['js settings']['formblock']['dependent'][$element['#id']] = $js;
}
else {
$path = drupal_get_path('module', 'formblock');
drupal_add_js($path . '/formblock.js', 'module', 'header');
$options['formblock']['dependent'][$element['#id']] = $js;
drupal_add_js($options, 'setting');
}
}
return $element;
}