You are here

function _panels_tabs_add_js in Panels Tabs 6

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

Adds the .js file only once per page load.

2 calls to _panels_tabs_add_js()
theme_panels_tabs_style_render_panel in plugins/styles/tabs.inc
Render panel callback (legacy).
theme_panels_tabs_style_render_region in plugins/styles/tabs.inc
Render region callback.

File

./panels_tabs.module, line 123
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;
  }
}