You are here

function toc_filter_init in TOC filter 7

Same name and namespace in other branches
  1. 6 toc_filter.module \toc_filter_init()

Implements hook_init().

File

./toc_filter.module, line 10
Converts header tags into a linked table of contents.

Code

function toc_filter_init() {
  if (module_exists('ctools')) {
    drupal_add_js(drupal_get_path('module', 'ctools') . '/js/jump-menu.js', array(
      'type' => 'file',
      'every_page' => TRUE,
    ));
  }
  if (variable_get('toc_filter_smooth_scroll', '1')) {
    drupal_add_js(drupal_get_path('module', 'toc_filter') . '/toc_filter.js', array(
      'type' => 'file',
      'every_page' => TRUE,
    ));
    $settings = array(
      'toc_filter_smooth_scroll_duration' => variable_get('toc_filter_smooth_scroll_duration', ''),
    );
    drupal_add_js($settings, 'setting');
  }
}