I'm playing around with a new site on Drupal 6 and have the following code in the view hook function of a module I'm building:

...
$slide_data = array(
'title' => t($node->title),
'no_of_rows' => $no_of_rows,
'rows' => $rows,
);

$node->content['myfield'] = array(
'#value' => theme('istv_slidepreview', $slide_data),
'#weight' => 1,
);

function theme_istv_slidepreview($slide_data) {
...
}

Weird enough, the themed function never gets called. If I change to an "ordinary" function call without using the theme function it works:

$node->content['myfield'] = array(
'#value' => istv_slidepreview($slide_data),
'#weight' => 1,
);

function istv_slidepreview($slide_data) {
...
}

What am I missing? Scratching my head...

Petter

Comments

skywalker2208’s picture

Are you using the new hook_theme that is new in drupal 6.
hook_theme

If you are using the new hook_theme then trying clearing your cache because that was a problem I had before.

PWG’s picture

I wasn't using but now that I've come to understand that I need to use it to register all my theme functions I sure am. :) After having implemented it I visited Administer->Modules which triggered the hook_theme function and now everything works perfectly.

Thanks!

Petter