You are here

function collapsiblock_init in Collapsiblock 7

Same name and namespace in other branches
  1. 6 collapsiblock.module \collapsiblock_init()
  2. 7.2 collapsiblock.module \collapsiblock_init()

Implements hook_init().

File

./collapsiblock.module, line 11
Make blocks collapsible.

Code

function collapsiblock_init() {

  // Load the settings.
  global $theme;
  $current_theme = $theme ? $theme : variable_get('theme_default', 'bartik');
  $theme_settings = variable_get(str_replace('/', '_', 'theme_' . $current_theme . '_settings'), array());
  $theme_settings = array_merge(collapsiblock_default_settings(), $theme_settings, array());
  drupal_add_library('system', 'jquery.cookie');
  drupal_add_js(array(
    'collapsiblock' => array(
      'blocks' => array_change_key_case(variable_get('collapsiblock_settings', array()), CASE_LOWER),
      'default_state' => variable_get('collapsiblock_default_state', 1),
      'active_pages' => variable_get('collapsiblock_active_pages', FALSE),
      'slide_type' => variable_get('collapsiblock_slide_type', 1),
      'slide_speed' => variable_get('collapsiblock_slide_speed', 200),
      'block_title' => $theme_settings['collapsiblock_title'],
      'block' => $theme_settings['collapsiblock_block'],
      'block_content' => $theme_settings['collapsiblock_content'],
    ),
  ), array(
    'type' => 'setting',
    'scope' => JS_DEFAULT,
  ));
}