1

I use PHP filter module, and write this in other field in my node:

<?php
  $node = node_load(52);
  $field = field_view_field('node', $node, 'myfield');
  print $field;
?>

It doesnt work. And how i can load id for node?

1
  • 1
    To get get current page node id you can use " print arg(1) "
    – DRUPWAY
    Commented Aug 25, 2015 at 7:32

1 Answer 1

2

field_view_field returns a renderable array for the field value. So you should use render() function:

<?php
  $node = node_load(52);
  $field = field_view_field('node', $node, 'myfield');
  print render($field);
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.