Needs review
Project:
Twitter Pull
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
10 Sep 2011 at 17:47 UTC
Updated:
10 Sep 2011 at 17:47 UTC
I've found that the module's hook_block_view implementation won't ever produce a match on $delta if multiple blocks are added.
Current code from twitter_pull.module:
<?php
/**
* Implementation of hook_block_view()
*/
function twitter_pull_block_view($delta = '') {
$info = twitter_pull_block_data();
$b_info = $info["$delta"];
$content = twitter_pull_render($b_info->tweetkey, $b_info->title, $b_info->number_of_items, $b_info->theme_key);
return array("subject"=>"", "content"=>$content);
}
?>
<?php
$b_info = $info["$delta"]; // <- This will never actually match a delta value if the example hook_block format on the project page is followed.
?>
This code works for me:
<?php
/**
* Implementation of hook_block_view()
*/
function twitter_pull_block_view($delta = '') {
$info = twitter_pull_block_data();
foreach($info as $key => $value) if($value->delta==$delta) $b_info = $value;
if(!isset($b_info)) $b_info = $info[0];
$content = twitter_pull_render($b_info->tweetkey, $b_info->title, $b_info->number_of_items, $b_info->theme_key);
return array("subject"=>"", "content"=>$content);
}
?>