theme_block_admin_display

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/block/block.module, строка 296

Версии
5
theme_block_admin_display($form)

Theme main block administration form submission.

Note: the blocks are already sorted in the right order, grouped by status, region and weight.

Код

<?php
function theme_block_admin_display($form) {
  global $theme_key;

  $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>');
  }

  // 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 = $region != BLOCK_REGION_NONE;

      // 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 ? 6 : 5)));
        $last_region = $region;
      }
      // Output disabled header
      elseif ($status != $last_status) {
        $rows[] = array(array('data' => t('Disabled'), 'class' => 'region', 'colspan' => ($throttle ? 6 : 5)));
        $last_status = $status;
      }

      // Generate block row
      $row = array(
        array('data' => drupal_render($block['info']), 'class' => 'block'),
        drupal_render($block['region']) . drupal_render($block['theme']),
        drupal_render($block['weight']),
      );
      if ($throttle) {
        $row[] = drupal_render($block['throttle']);
      }
      $row[] = drupal_render($block['configure']);
      $row[] = $block['delete'] ? drupal_render($block['delete']) : '';
      $rows[] = $row;
    }
  }

  // Finish table
  $header = array(t('Block'), t('Region'), t('Weight'));
  if ($throttle) {
    $header[] = t('Throttle');
  }
  $header[] = array('data' => t('Operations'), 'colspan' => 2);

  $output = theme('table', $header, $rows, array('id' => 'blocks'));

  $output .= drupal_render($form);

  return $output;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему