You are here

function auto_height_page_build in jQuery Auto Height 7

Same name and namespace in other branches
  1. 7.2 auto_height.module \auto_height_page_build()

Implements hook_page_build().

Include jQuery AutoHeight plugin on every page

File

./auto_height.module, line 91
Provides dynamic adjustment of column heights, matching the biggest column in each Row.

Code

function auto_height_page_build(&$page) {

  // Is the library installed?
  $path = libraries_get_path('autoheight') . '/jquery.autoheight.js';

  // if required, use plugin packaged with the module.
  $installed = file_exists($path);
  if (!$installed) {
    return;
  }

  // Add the library reference
  drupal_add_js($path, array(
    'group' => JS_LIBRARY,
    'every_page' => TRUE,
  ));

  // Get all the class selectors.
  $autoheight_selectors = variable_get('autoheight_selectors', AUTOHEIGHT_DEFAULT_SELECTOR);
  $autoheight_selectors_array = explode(PHP_EOL, $autoheight_selectors);

  // Export these variables to Drupal.settings
  drupal_add_js(array(
    'autoheight' => array(
      'selectors' => $autoheight_selectors_array,
    ),
  ), 'setting');
}