$node variable inaccessible to computed fields

Viswanathan - November 24, 2008 - 06:05
Project:Computed Field
Version:6.x-1.0-beta3
Component:Code
Category:support request
Priority:critical
Assigned:Unassigned
Status:active
Description

Hi,

Im creating a content(node) with 4 fields. One among the field type is computed field. In that, im displaying $node->nid. I mean $display = $node->nid. I hope $node->nid will show the nid of the node.

In my view, im showing the computed field but its coming as empty.

Im using Drupal 6. Can u pls tel wat r d changes i need to do?

#1

XiaN Vizjereij - February 20, 2009 - 14:13

http://drupal.org/node/358306

That helped for me. Simply edit/save every affected node after changing sth. in the computed field.

#2

zmove - April 1, 2009 - 15:09

Hmm, I'm not sure the solution listed above are good.

I have the same problem, on the display textarea, the $node object don't seems available, even if you edit and save your node again.

#3

solonim - April 27, 2009 - 16:10

I have the same problem. The $node object is available for the "computed code field" but not for the "display format field".
There is a solution to use $node object in display format without put the value in $node_field[0]['value'] in the computed code?

#4

krishnaa - August 10, 2009 - 07:33

You can try this,it will work.

Put this code in Display Format field of computed field.

$args = func_get_args();
$node_field_item['value']=$args[0]['#node']->nid;
print $display = $node_field_item['value'];

#5

nicholas.alipaz - August 13, 2009 - 16:24
Title:Computed Field is not displaying $node->nid value» $node variable inaccessible to computed fields

Sure #4 works, but this is most certainly a bug. the $node object does not seem to be accessible which completely breaks the functionality needed.

#6

nicholas.alipaz - August 13, 2009 - 16:44
Version:6.x-1.x-dev» 6.x-1.0-beta3

Just to confirm this issue... It is present in beta3. If you go back to beta2 then the $node object becomes accessible again. Someone must have made a "boo boo" on the last version!

 
 

Drupal is a registered trademark of Dries Buytaert.