block_admin_display
modules/block/block.module, строка 205
- Версии
- 5 – 6
block_admin_display($theme = NULL)
Generate main block administration form.
Код
<?php
function block_admin_display($theme = NULL) {
global $theme_key, $custom_theme;
// Add CSS
drupal_add_css(drupal_get_path('module', 'block') .'/block.css', 'module', 'all', FALSE);
// If non-default theme configuration has been selected, set the custom theme.
if ($theme) {
$custom_theme = $theme;
}
else {
$custom_theme = variable_get('theme_default', 'garland');
}
init_theme();
// Fetch and sort blocks
$blocks = _block_rehash();
usort($blocks, '_block_compare');
$throttle = module_exists('throttle');
$block_regions = array(BLOCK_REGION_NONE => '<'. t('none') .'>') + system_region_list($theme_key);
// Build form tree
$form['#action'] = arg(3) ? url('admin/build/block/list/'. $theme_key) : url('admin/build/block');
$form['#tree'] = TRUE;
foreach ($blocks as $i => $block) {
$form[$i]['module'] = array('#type' => 'value', '#value' => $block['module']);
$form[$i]['delta'] = array('#type' => 'value', '#value' => $block['delta']);
$form[$i]['info'] = array('#value' => check_plain($block['info']));
$form[$i]['theme'] = array('#type' => 'hidden', '#value' => $theme_key);
$form[$i]['weight'] = array('#type' => 'weight', '#default_value' => $block['weight']);
$form[$i]['region'] = array('#type' => 'select',
'#default_value' => $block['status'] ? (isset($block['region']) ? $block['region'] : system_default_region($theme_key)) : BLOCK_REGION_NONE,
'#options' => $block_regions,
);
if ($throttle) {
$form[$i]['throttle'] = array('#type' => 'checkbox', '#default_value' => $block['throttle']);
}
$form[$i]['configure'] = array('#value' => l(t('configure'), 'admin/build/block/configure/'. $block['module'] .'/'. $block['delta']));
if ($block['module'] == 'block') {
$form[$i]['delete'] = array('#value' => l(t('delete'), 'admin/build/block/delete/'. $block['delta']));
}
}
$form['submit'] = array('#type' => 'submit', '#value' => t('Save blocks'));
return $form;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии