You are here

function conditional_fields_add_js in Conditional Fields 6

Same name and namespace in other branches
  1. 5 conditional_fields.module \conditional_fields_add_js()
  2. 6.2 conditional_fields.module \conditional_fields_add_js()

Adds javascript to the node editing form

2 calls to conditional_fields_add_js()
conditional_fields_node_editing_form in ./conditional_fields.module
Alteration of the node editing form
conditional_fields_node_editing_form_validate in ./conditional_fields.module
Validation for node editing form.

File

./conditional_fields.module, line 935
Content fields and groups visibility based on the values of user defined 'trigger' fields.

Code

function conditional_fields_add_js($settings) {

  // Avoid adding js twice when the node form has failed validation
  static $js;
  if (!$js) {
    drupal_add_js(array(
      'ConditionalFields' => $settings,
    ), 'setting');
    drupal_add_js(drupal_get_path('module', 'conditional_fields') . '/conditional_fields.js');
    $js = TRUE;
  }
}