You are here

function template_preprocess_homebox in Homebox 6.2

Same name and namespace in other branches
  1. 6.3 homebox.module \template_preprocess_homebox()
  2. 6 homebox.module \template_preprocess_homebox()
  3. 7.3 homebox.module \template_preprocess_homebox()
  4. 7.2 homebox.module \template_preprocess_homebox()

Preprocesses variables for home-box.tpl.php template

Parameters

$variables: An array containing variables to used in home-box.tpl.php

Return value

An array containing preprocessed variables (see home-box.tpl.php)

File

./homebox.module, line 255
Homebox main file, takes care of global functions settings constants, etc.

Code

function template_preprocess_homebox(&$variables) {

  // Add required jQuery UI files
  jquery_ui_add(array(
    'ui.draggable',
    'ui.droppable',
    'ui.sortable',
  ));

  // Add Homebox JavaScript files
  drupal_add_js(drupal_get_path('module', 'homebox') . '/homebox.js', 'module', 'header', FALSE, TRUE, TRUE);
  drupal_add_js(drupal_get_path('module', 'homebox') . '/includes/tipsy/jquery.tipsy.js', 'module', 'header', FALSE, TRUE, TRUE);

  // Add CSS for homebox
  drupal_add_css(drupal_get_path('module', 'homebox') . '/homebox.css', 'module', 'all', TRUE);
  drupal_add_css(drupal_get_path('module', 'homebox') . '/includes/tipsy/tipsy.css', 'module', 'all', TRUE);
  $classes = array(
    'column-count-' . $variables['column_count'],
    'homebox-' . $variables['page']->name,
  );
  if ($variables['page']->settings['auto_save']) {
    $classes[] = 'homebox-auto-save';
  }
  $variables['classes'] = implode(' ', $classes);
  return $variables;
}