You are here

function template_preprocess_homebox_admin_display_form in Homebox 6

Same name and namespace in other branches
  1. 6.3 homebox.admin.inc \template_preprocess_homebox_admin_display_form()
  2. 6.2 homebox.admin.inc \template_preprocess_homebox_admin_display_form()
  3. 7.3 homebox.admin.inc \template_preprocess_homebox_admin_display_form()
  4. 7.2 homebox.admin.inc \template_preprocess_homebox_admin_display_form()

Process variables for homebox-admin-display.tpl.php.

Parameters

$variables:

See also

theme_homebox_admin_display()

File

./homebox.admin.inc, line 373
Home box admin file, takes care admin interface for homebox

Code

function template_preprocess_homebox_admin_display_form(&$variables) {
  global $theme_key;
  drupal_add_css($path = drupal_get_path('module', 'homebox') . '/homebox.css', $type = 'module', $media = 'all', $preprocess = TRUE);
  $block_regions = homebox_named_columns($variables['form']['pid']['#value']);
  $variables['block_regions'] = $block_regions + array(
    HOMEBOX_REGION_NONE => t('Disabled'),
  );
  foreach ($block_regions as $key => $value) {

    // Initialize an empty array for the region.
    $variables['block_listing'][$key] = array();
  }

  // Initialize disabled blocks array.
  $variables['block_listing'][BLOCK_REGION_NONE] = array();

  // Set up to track previous region in loop.
  $last_region = '';
  foreach (element_children($variables['form']) as $i) {
    $block =& $variables['form'][$i];

    // Only take form elements that are blocks.
    if (isset($block['info'])) {

      // Fetch region for current block.
      $region = $block['region']['#default_value'];

      // Set special classes needed for table drag and drop.
      $variables['form'][$i]['region']['#attributes']['class'] = 'block-region-select block-region-' . $region;
      $variables['form'][$i]['weight']['#attributes']['class'] = 'block-weight block-weight-' . $region;
      $variables['block_listing'][$region][$i]->row_class = isset($block['#attributes']['class']) ? $block['#attributes']['class'] : '';
      $variables['block_listing'][$region][$i]->block_modified = isset($block['#attributes']['class']) && strpos($block['#attributes']['class'], 'block-modified') !== FALSE ? TRUE : FALSE;
      $variables['block_listing'][$region][$i]->block_title = drupal_render($block['info']);
      $variables['block_listing'][$region][$i]->region_select = drupal_render($block['region']) . drupal_render($block['theme']);
      $variables['block_listing'][$region][$i]->weight_select = drupal_render($block['weight']);
      $variables['block_listing'][$region][$i]->status = drupal_render($block['status']);
      $variables['block_listing'][$region][$i]->open = drupal_render($block['open']);
      $variables['block_listing'][$region][$i]->movable = drupal_render($block['movable']);
      $variables['block_listing'][$region][$i]->bid = drupal_render($block['bid']);
      $variables['block_listing'][$region][$i]->printed = FALSE;
      $last_region = $region;
    }
  }
  $variables['form_submit'] = drupal_render($variables['form']);
}