function theme_block_admin_display in Drupal 4
Same name and namespace in other branches
- 5 modules/block/block.module \theme_block_admin_display()
Theme main block administration form submission.
Note: the blocks are already sorted in the right order, grouped by status, region and weight.
File
- modules/
block.module, line 288 - Controls the boxes that are displayed around the main content.
Code
function theme_block_admin_display($form) {
global $theme_key;
$throttle = module_exist('throttle');
$block_regions = system_region_list($theme_key);
// Highlight regions on page to provide visual reference.
foreach ($block_regions as $key => $value) {
drupal_set_content($key, '<div class="block-region">' . $value . '</div>');
}
// Build rows
$rows = array();
$last_region = '';
$last_status = 1;
foreach (element_children($form) as $i) {
$block =& $form[$i];
// Only take form elements that are blocks.
if (is_array($block['info'])) {
// Fetch values
$region = $block['region']['#default_value'];
$status = $block['status']['#default_value'];
// Output region header
if ($status && $region != $last_region) {
$region_title = t('%region', array(
'%region' => drupal_ucfirst($block_regions[$region]),
));
$rows[] = array(
array(
'data' => $region_title,
'class' => 'region',
'colspan' => $throttle ? 7 : 6,
),
);
$last_region = $region;
}
elseif ($status != $last_status) {
$rows[] = array(
array(
'data' => t('Disabled'),
'class' => 'region',
'colspan' => $throttle ? 7 : 6,
),
);
$last_status = $status;
}
// Generate block row
$row = array(
array(
'data' => form_render($block['info']),
'class' => 'block',
),
form_render($block['status']) . form_render($block['theme']),
form_render($block['weight']),
form_render($block['region']),
);
if ($throttle) {
$row[] = form_render($block['throttle']);
}
$row[] = form_render($block['configure']);
$row[] = $block['delete'] ? form_render($block['delete']) : '';
$rows[] = $row;
}
}
// Finish table
$header = array(
t('Block'),
t('Enabled'),
t('Weight'),
t('Placement'),
);
if ($throttle) {
$header[] = t('Throttle');
}
$header[] = array(
'data' => t('Operations'),
'colspan' => 2,
);
$output = theme('table', $header, $rows, array(
'id' => 'blocks',
));
$output .= form_render($form['submit']);
$output .= form_render($form);
return $output;
}