You are here

function _panels_tabs_add_js in Panels Tabs 5

Same name and namespace in other branches
  1. 6 panels_tabs.module \_panels_tabs_add_js()

Adds the .js file only once per page load.

1 call to _panels_tabs_add_js()
theme_panels_tabs_style_render_panel in ./panels_tabs.module
Render callback.

File

./panels_tabs.module, line 117
Definition of the 'tabs' panel style.

Code

function _panels_tabs_add_js($id, $filling_tabs) {
  static $added = FALSE;
  static $settings_added;

  // Include the JavaScript once per page.
  if (!$added) {
    drupal_add_js(drupal_get_path('module', 'panels_tabs') . '/panels_tabs.js');
    $added = TRUE;
  }

  // Store the JavaScript settings for every panel that uses this style.
  if (!isset($settings_added[$id])) {
    drupal_add_js(array(
      'panelsTabs' => array(
        $id => array(
          'fillingTabs' => isset($filling_tabs) ? $filling_tabs : 'disabled',
        ),
      ),
    ), 'setting');
    $settings_added[$id] = TRUE;
  }
}