You are here

function floating_block_init in Floating block 7

Same name and namespace in other branches
  1. 6 floating_block.module \floating_block_init()

Implements hook_init().

File

./floating_block.module, line 12
The floating_block module allows parts of the site to stay on the page when scrolling.

Code

function floating_block_init() {
  $floating_blocks = variable_get('floating_blocks', array());

  //Only load the javascript if floating blocks have been configured.
  if (count($floating_blocks)) {
    drupal_add_js(array(
      'floating_block' => array(
        'settings' => $floating_blocks,
        'minWidth' => variable_get('floating_block_min_width', 0),
      ),
    ), array(
      'type' => 'setting',
      'scope' => JS_DEFAULT,
    ));
    drupal_add_js(drupal_get_path('module', 'floating_block') . '/floating_block.js');
  }
}