开发者

Drupal Pressflow problem with hook_block

i'm having troubles with implementing the hook_block hook in a clean Pressflow installation. For some reason it always outputs ArrayArray for all my blocks. The reason for this is that the $info variable in the theme function is set to:

["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"
}

}

as you can see this is overwritten with my custom hook_block method. So now it thinks blocks should be rendered using my fwtb_block method which returns an array containing the subject and the content. That's why it prints ArrayArray. Any idea what is goi开发者_StackOverflow社区ng wrong here?

This is my hook_block implementation:

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;
}

}

kind regards, Daan


After taking a fresh look to my setup i saw what the problem was. I had a theme and a module with the same name. This caused some conflicts :/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜