$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 |
Jump to:
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
http://drupal.org/node/358306
That helped for me. Simply edit/save every affected node after changing sth. in the computed field.
#2
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
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
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
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
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!