You are here

function template_preprocess_homebox in Homebox 7.2

Same name and namespace in other branches
  1. 6.3 homebox.module \template_preprocess_homebox()
  2. 6 homebox.module \template_preprocess_homebox()
  3. 6.2 homebox.module \template_preprocess_homebox()
  4. 7.3 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 290
Homebox main file, takes care of global functions settings constants, etc.

Code

function template_preprocess_homebox(&$variables) {
  $module_path = drupal_get_path('module', 'homebox');

  // Check to make sure a user is logged in.
  if (user_is_logged_in()) {

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

    // Add Homebox JavaScript files
    drupal_add_js($module_path . '/homebox.js', array(
      'type' => 'file',
      'scope' => 'header',
      'group' => JS_DEFAULT,
      'defer' => FALSE,
      'cache' => TRUE,
      'preprocess' => TRUE,
    ));
    if (isset($variables['page']->settings['auto_save']) && $variables['page']->settings['auto_save']) {
      $variables['classes_array'][] = 'homebox-auto-save';
    }
  }

  // Add CSS for homebox
  drupal_add_css($module_path . '/homebox.css', array(
    'type' => 'file',
    'group' => CSS_DEFAULT,
    'media' => 'all',
    'preprocess' => TRUE,
  ));
  $variables['classes_array'][] = 'column-count-' . $variables['column_count'];
  $variables['classes_array'][] = 'homebox-' . $variables['page']->name;
}