I'm using computed field for my content types, but when I used $node, in Display Code, it doesn't display anything :
global $node;
$display_output = l("Apply", "apply_form?job_offer=".$node->nid);
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI'm using computed field for my content types, but when I used $node, in Display Code, it doesn't display anything :
global $node;
$display_output = l("Apply", "apply_form?job_offer=".$node->nid);
First of all, you are supposed to write to $entity_field[0]['value']
. Second problem is that fields operate on entities, not nodes, so you need to use $entity
instead. You can always use Devel module and dpr($entity)
to see what's in it.
node id
should be in the entity field if it is a node. In which case you can load it with node_load()
.
node_load();
– Steven
Sep 24 '13 at 12:40