You are here

function accordions_js in Accordions 7

Helper function to add javascript library & type-specific settings.

We don't actually add the settings until hook_js_alter(), so that all the accordions types settings can be added together at the last possible minute, to make merging them together into one array easier.

2 calls to accordions_js()
accordions_js_alter in ./accordions.module
Implements hook_js_alter().
accordions_preprocess_block in ./accordions.module
Implements hook_preprocess_block().

File

./accordions.module, line 175

Code

function accordions_js($type = NULL) {
  drupal_add_library('accordions', 'accordions.collapse');
  $js =& drupal_static(__FUNCTION__, array());
  if (isset($type) && !isset($js[$type])) {
    $js[$type] = array();
    $info = accordions_get_types(TRUE);
    if (isset($info[$type])) {
      $js[$type]['label'] = $info[$type]['label selector'];
      $js[$type]['content'] = $info[$type]['content selector'];
    }
  }
  return $js;
}