You are here

function template_preprocess_block_admin_display_form in Drupal 6

Same name and namespace in other branches
  1. 7 modules/block/block.admin.inc \template_preprocess_block_admin_display_form()

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

The $variables array contains the following arguments:

  • $form

See also

block-admin-display.tpl.php

theme_block_admin_display()

File

modules/block/block.admin.inc, line 357
Admin page callbacks for the block module.

Code

function template_preprocess_block_admin_display_form(&$variables) {
  global $theme_key;
  $block_regions = system_region_list($theme_key);
  $variables['throttle'] = module_exists('throttle');
  $variables['block_regions'] = $block_regions + array(
    BLOCK_REGION_NONE => t('Disabled'),
  );
  foreach ($block_regions as $key => $value) {

    // Highlight regions on page to provide visual reference.
    drupal_set_content($key, '<div class="block-region">' . $value . '</div>');

    // 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] = new stdClass();
      $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]->throttle_check = $variables['throttle'] ? drupal_render($block['throttle']) : '';
      $variables['block_listing'][$region][$i]->configure_link = drupal_render($block['configure']);
      $variables['block_listing'][$region][$i]->delete_link = !empty($block['delete']) ? drupal_render($block['delete']) : '';
      $variables['block_listing'][$region][$i]->printed = FALSE;
      $last_region = $region;
    }
  }
  $variables['form_submit'] = drupal_render($variables['form']);
}