You are here

function template_preprocess_homebox_admin_display_form in Homebox 7.3

Same name and namespace in other branches
  1. 6.3 homebox.admin.inc \template_preprocess_homebox_admin_display_form()
  2. 6 homebox.admin.inc \template_preprocess_homebox_admin_display_form()
  3. 6.2 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 646
Homebox admin file, takes care admin interface for homebox

Code

function template_preprocess_homebox_admin_display_form(&$variables) {
  drupal_add_css(drupal_get_path('module', 'homebox') . '/homebox.css', array(
    'type' => 'module',
    'media' => 'all',
    'preprocess' => TRUE,
  ));

  // Load page
  if (isset($variables['form']['name']['#value'])) {
    $page = homebox_get_page($variables['form']['name']['#value']);
    $block_regions = homebox_named_columns($page->settings['regions']);
  }
  else {
    $block_regions = homebox_named_columns(0);
  }
  $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'] = array(
        'block-region-select block-region-' . $region,
      );
      $variables['form'][$i]['weight']['#attributes']['class'] = array(
        'block-weight block-weight-' . $region,
      );
      $variables['block_listing'][$region][$i] = new stdClass();
      $variables['block_listing'][$region][$i]->row_class = isset($block['#attributes']['class']) ? $block['#attributes']['class'] : array();
      $variables['block_listing'][$region][$i]->block_modified = isset($block['#attributes']['class']['block-modified']) ? TRUE : FALSE;
      $variables['block_listing'][$region][$i]->block_title = check_plain($block['info']['#value']);
      $variables['block_listing'][$region][$i]->region_select = drupal_render($block['region']) . drupal_render($block['theme']);
      $variables['block_listing'][$region][$i]->title = drupal_render($block['title']);
      $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]->closable = drupal_render($block['closable']);
      $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_children($variables['form']);
}