在Drupal 7中更改寻呼机格式

时间:2011-11-08 06:46:17

标签: drupal drupal-6 format drupal-7 pager

我有以下代码来更改Drupal 6中的寻呼机格式(重新构建)。但它在Drupal 7中不起作用。它会抛出太多错误:(

function theme_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9) {
          $pager_list = theme('pager_list', $tags, $limit, $element, $parameters, $quantity);

          $links = array();
          $links['pager-first'] = theme('pager_first', ($tags[0] ? $tags[0] : t('FIRST')), $limit, $element, $parameters);
          $links['pager-previous'] = theme('pager_previous', ($tags[1] ? $tags[1] : t('PREV')), $limit, $element, 1, $parameters);
          $links = array_filter($links);
          $pager_links_1 = theme('links', $links, array('class' => 'links pager pager-links left'));

          $links = array();
          $links['pager-next'] = theme('pager_next', ($tags[3] ? $tags[3] : t('NEXT')), $limit, $element, 1, $parameters);
          $links['pager-last'] = theme('pager_last', ($tags[4] ? $tags[4] : t('LAST')), $limit, $element, $parameters);
          $links = array_filter($links);
          $pager_links_2 = theme('links', $links, array('class' => 'links pager pager-links right'));

          if(empty($pager_links_1)){
             if ($pager_list) {
                 return "<div class='pager clear-block'><div class='pager-wrapper'><ul class='links pager pager-links LeftClass'><li><span>PREV</span></li></ul>$pager_links_1 $pager_list $pager_links_2</div></div>";
             }
          }

          if(empty($pager_links_2)){
             if ($pager_list) {
                 return "<div class='pager clear-block'><div class='pager-wrapper'>$pager_links_1 $pager_list $pager_links_2<ul class='links pager pager-links RightClass'><li><span>NEXT</span></li></ul></div></div>";
             }
          }

          if ($pager_list) {
            return "<div class='pager clear-block'><div class='pager-wrapper'>$pager_links_1 $pager_list $pager_links_2</div></div>";
          }
}

1 个答案:

答案 0 :(得分:1)

Drupal 7 theme_pager函数与Drupal 6函数相反,只接受一个参数($ variables)。

$ variables参数是一个包含各个Drupal 6参数的数组。

请参阅http://api.drupal.org/api/drupal/includes--pager.inc/function/theme_pager/7