You are here

function block_refresh_init in Block Refresh 7.2

Same name and namespace in other branches
  1. 6 block_refresh.module \block_refresh_init()
  2. 7 block_refresh.module \block_refresh_init()

Implements hook_init(). Calls the jquery to refresh blocks automatically, but only if the blocks exist on the current page and are enabled

File

./block_refresh.module, line 17

Code

function block_refresh_init() {
  if (user_access(BLOCK_REFRESH_ACCESS_CONTENT_PERMISSION)) {
    drupal_add_js(drupal_get_path('module', 'block_refresh') . '/js/block_refresh.js', array(
      'scope' => 'footer',
    ));
    drupal_add_css(drupal_get_path('module', 'block_refresh') . '/css/block_refresh.css');
    drupal_add_js(array(
      'block_refresh' => array(
        'settings' => variable_get('block_refresh_settings', array()),
        'args' => arg(),
        'query' => block_refresh_get_query_as_string(),
      ),
    ), 'setting');
  }
}