You are here

function itoggle_include_settings in iToggle 7.2

Same name and namespace in other branches
  1. 7 includes/itoggle.inc \itoggle_include_settings()

Add iToggle settings to Drupal.settings object.

See also

itoggle_include_itoggle()

1 call to itoggle_include_settings()
itoggle_include_itoggle in ./itoggle.module
Include iToggle css and javascript files.

File

./itoggle.module, line 254
iToggle core module.

Code

function itoggle_include_settings() {

  // We test if the settings are already configured.
  $drupal_js = drupal_add_js();
  $drupal_js_settings = $drupal_js['settings']['data'];
  foreach ($drupal_js_settings as $setting) {
    if (isset($setting['itoggle'])) {
      return;
    }
  }
  $settings = array(
    'itoggle' => array(
      'speed' => variable_get('itoggle_speed', 200),
      'onclick' => variable_get('itoggle_onclick', ''),
      'onclickon' => variable_get('itoggle_onclickon', ''),
      'onclickoff' => variable_get('itoggle_onclickoff', ''),
      'onslide' => variable_get('itoggle_onslide', ''),
      'onslideon' => variable_get('itoggle_onslideon', ''),
      'onslideoff' => variable_get('itoggle_onslideoff', ''),
    ),
  );
  if ($easing = variable_get('itoggle_easing_function', '')) {
    $settings['itoggle']['easing'] = $easing;
    libraries_load('easing');
  }
  drupal_add_js($settings, 'setting');
}