You are here

function colorbox_node_preprocess_html in Colorbox Node 7.3

Same name and namespace in other branches
  1. 7.2 colorbox_node.module \colorbox_node_preprocess_html()

Implments hook_preprocess_html().

File

./colorbox_node.module, line 12
Creates a menu callback with support for displaying a node inside of a colorbox.

Code

function colorbox_node_preprocess_html() {

  // check to see if colorbox should be active.
  if (!_colorbox_active()) {
    return;

    // Don't add the JavaScript and CSS on specified paths.
  }

  // We need to include our misc/ajax.js function all the time in case
  // since we are using the built in AJAX Framework
  drupal_add_library('system', 'drupal.ajax');
  drupal_add_js(drupal_get_path('module', 'colorbox_node') . '/colorbox_node.js', array(
    'type' => 'file',
    'weight' => 10,
  ));
  $js_settings = array(
    'width' => variable_get('colorbox_node_width', '600px'),
    'height' => variable_get('colorbox_node_height', '600px'),
  );

  // Allow other modules to add or change the default settings.
  drupal_alter('colorbox_node_settings', $js_settings);
  drupal_add_js(array(
    'colorbox_node' => $js_settings,
  ), array(
    'type' => 'setting',
    'scope' => JS_DEFAULT,
  ));
}