Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

own theme in module

I am writing module for drupal 7. Module generates block and item list inside that block['content']. When i am using standard theme('item_list', array('items' => $items)) everything works, but when i want to define my own theme which will be used instead of item_list, block dissapears. I've been reading documentation and various examples, but nothing helped. In my module's file i wrote:

function lastposts_thm_theme() {
  return array(
   'lastposts_thm' => array(
   'variables' => array('items' => NULL),
   //template file, path, ....
   ),
 );
}
function theme_lastposts_thm($variables) {
  $node = $variables['items'];
  $build = node_view($node);
  $output = drupal_render($build);

  return $output;
}

And when i call it from block_view function, it doesn't work theme('lastposts_thm', $...). Where i am mistaking?

like image 488
Ian J Avatar asked Aug 08 '26 01:08

Ian J


1 Answers

Check if your theme prints the variables for the blocks and has the region defined in the info field of your theme. That could be the issue you are facing. .

like image 130
Binny K Thomas Avatar answered Aug 10 '26 12:08

Binny K Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!