You are here

function pagestyle_jq_cookie in Page Style 5

Note: By default the "jQuery Cookie Plugin" is required. Download the plugin from http://plugins.jquery.com/project/Cookie in the modul pagestyle.

1 call to pagestyle_jq_cookie()
pagestyle_init in ./pagestyle.module
Implement hook_init().

File

./pagestyle.module, line 381
Display a style changer on the page and in the browser menue for a better web accessibility.

Code

function pagestyle_jq_cookie() {
  if (!function_exists("drupal_get_path")) {
    function drupal_get_path($type, $name) {
      return dirname(drupal_get_filename($type, $name));
    }
  }
  if (function_exists('drupal_add_js')) {
    $pagestyle_jquery_cookie = drupal_get_path('module', 'pagestyle') . '/jquery.cookie.js';
    $jquery_cookie_plugin_link = l(t('jQuery Cookie plugin'), 'http://plugins.jquery.com/project/Cookie');
    if (!file_exists($pagestyle_jquery_cookie)) {
      drupal_set_message(t('The Page Style module require the !jquery_cookie_plugin_link.', array(
        '!jquery_cookie_plugin_link' => $jquery_cookie_plugin_link,
      )) . ' ' . t('Place the plugin (%jquery_cookie_js) in the module directory "%pagestyle_directory".', array(
        '%jquery_cookie_js' => 'jquery.cookie.js',
        '%pagestyle_directory' => drupal_get_path('module', 'pagestyle'),
      )), 'error');
    }
    elseif (file_exists($pagestyle_jquery_cookie)) {
      drupal_add_js(drupal_get_path('module', 'pagestyle') . '/jquery.cookie.js');
    }
  }
}