0

我在干净的 Pressflow 安装中实施 hook_block 钩子时遇到了麻烦。出于某种原因,它总是为我的所有块输出 ArrayArray。原因是主题函数中的$info变量设置为:

["block"]=>
array(7) {
["function"]=>
string(10) "fwtb_block"
["include files"]=>
array(0) {
}
["type"]=>
string(12) "theme_engine"
["theme path"]=>
string(21) "sites/all/themes/fwtb"
["arguments"]=>
array(1) {
  ["block"]=>
  NULL
}
["theme paths"]=>
array(2) {
  [0]=>
  string(14) "modules/system"
  [1]=>
  string(21) "sites/all/themes/fwtb"
}
["preprocess functions"]=>
array(2) {
  [0]=>
  string(19) "template_preprocess"
  [1]=>
  string(25) "template_preprocess_block"
}

}

如您所见,这已被我的自定义 hook_block 方法覆盖。所以现在它认为应该使用我的 fwtb_block 方法呈现块,该方法返回一个包含主题和内容的数组。这就是它打印 ArrayArray 的原因。知道这里出了什么问题吗?

这是我的 hook_block 实现:

function fwtb_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
  case 'list':
    $blocks['sidebar_description'] = array(
      'info' => t('Sidebar description'),
      'cache' => BLOCK_CACHE_GLOBAL,
      'status' => TRUE,
      'region' => 'left',
      'visibility' => 0,
      'custom' => FALSE
    );
    return $blocks;
  case 'configure':
    $form = array();
    return $form;
  case 'save':
    return;
  case 'view': default:
    switch ($delta) {
      case 'sidebar_description':
        $block['subject'] = t('block_subject');
        $block['content'] = t('block_description');
        break;
    }
    return $block;
}

}

亲切的问候,大安

4

1 回答 1

0

在重新审视我的设置后,我看到了问题所在。我有一个同名的主题和一个模块。这引起了一些冲突:/

于 2011-05-12T07:47:29.240 回答