Hi

I have a defined function inside template.php wich I'd like to use inside computefield. The function works perfectly when I call it from my templates (i.e. node.tpl.php) but it doesn't work at all when I call it from computed field. The weird issue for me (wich I don't know much PHP) is it doesn't return a "called to unkown function error" but just an empty return.

Where should I call this function?

Thanks in advance.

Comments

avibrazil@gmail.com’s picture

I get "unknown function" when my template function is called from inside Compute Code.

But it works when I call it from the Display Format.

Apparently, template functions are not available in Compute Code time but are available on Display Format time. On the other hand, $node is not available in Display Format time.

In my case, $node and other things should be available in Display Format.

avibrazil@gmail.com’s picture

I just realized that the $node object is actually accessible from the Display Format as $element['#node']. For example:

$element['#node']->nid
$element['#node']->taxonomy

etc...

mmjvb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)