diff options
-rw-r--r-- | modules/block/block.admin.inc | 59 | ||||
-rw-r--r-- | modules/block/block.module | 60 |
2 files changed, 60 insertions, 59 deletions
diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index 5af5fe5d2..0e450c629 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -299,3 +299,62 @@ function block_box_delete_submit($form, &$form_state) { $form_state['redirect'] = 'admin/build/block'; return; } + +/** + * Process variables for block-admin-display.tpl.php. + * + * The $variables array contains the following arguments: + * - $form + * + * @see block-admin-display.tpl.php + * @see theme_block_admin_display() + */ +function template_preprocess_block_admin_display(&$variables) { + global $theme_key; + + $variables['throttle'] = module_exists('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>'); + } + + // Setup 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']; + + // Track first block listing to insert region header inside block_admin_display.tpl.php. + $is_region_first = FALSE; + if ($last_region != $region) { + $is_region_first = TRUE; + // Set region title. Block regions already translated. + if ($region != BLOCK_REGION_NONE) { + $region_title = drupal_ucfirst($block_regions[$region]); + } + else { + $region_title = t('Disabled'); + } + } + + $variables['block_listing'][$i]->is_region_first = $is_region_first; + $variables['block_listing'][$i]->region_title = $region_title; + $variables['block_listing'][$i]->block_title = drupal_render($block['info']); + $variables['block_listing'][$i]->region_select = drupal_render($block['region']) . drupal_render($block['theme']); + $variables['block_listing'][$i]->weight_select = drupal_render($block['weight']); + $variables['block_listing'][$i]->throttle_check = $variables['throttle'] ? drupal_render($block['throttle']) : ''; + $variables['block_listing'][$i]->configure_link = drupal_render($block['configure']); + $variables['block_listing'][$i]->delete_link = !empty($block['delete']) ? drupal_render($block['delete']) : ''; + + $last_region = $region; + } + } + + $variables['form_submit'] = drupal_render($variables['form']); +} diff --git a/modules/block/block.module b/modules/block/block.module index cbaa3eff6..ca2a204f7 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -104,71 +104,13 @@ function block_theme() { return array( 'block_admin_display' => array( 'template' => 'block-admin-display', + 'file' => 'block.admin.inc', 'arguments' => array('form' => NULL), ), ); } /** - * Process variables for block-admin-display.tpl.php. - * - * The $variables array contains the following arguments: - * - $form - * - * @see block-admin-display.tpl.php - * @see theme_block_admin_display() - */ -function template_preprocess_block_admin_display(&$variables) { - global $theme_key; - - $variables['throttle'] = module_exists('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>'); - } - - // Setup 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']; - - // Track first block listing to insert region header inside block_admin_display.tpl.php. - $is_region_first = FALSE; - if ($last_region != $region) { - $is_region_first = TRUE; - // Set region title. Block regions already translated. - if ($region != BLOCK_REGION_NONE) { - $region_title = drupal_ucfirst($block_regions[$region]); - } - else { - $region_title = t('Disabled'); - } - } - - $variables['block_listing'][$i]->is_region_first = $is_region_first; - $variables['block_listing'][$i]->region_title = $region_title; - $variables['block_listing'][$i]->block_title = drupal_render($block['info']); - $variables['block_listing'][$i]->region_select = drupal_render($block['region']) . drupal_render($block['theme']); - $variables['block_listing'][$i]->weight_select = drupal_render($block['weight']); - $variables['block_listing'][$i]->throttle_check = $variables['throttle'] ? drupal_render($block['throttle']) : ''; - $variables['block_listing'][$i]->configure_link = drupal_render($block['configure']); - $variables['block_listing'][$i]->delete_link = !empty($block['delete']) ? drupal_render($block['delete']) : ''; - - $last_region = $region; - } - } - - $variables['form_submit'] = drupal_render($variables['form']); -} - -/** * Implementation of hook_perm(). */ function block_perm() { |