Drupal 7 - Getting bound objects using node_load ()

In the node template, the $ node object has an entity next to each target_id value, making things nice and easy.

However, if I load the node programmatically (via node_load), it only has the target_id value, no entity is bound. So I need to do a lot of manual load_taxonomy (target_id) to get this.

It is so clear that Drupal does this automatically at some point in the render line, but is there a function I could call to do this?

Thank!

+5
source share
1 answer

Try the following:

if ($node = node_load($node_id)) 
{
    $view = node_view($node);
}

http://api.drupal.org/api/drupal/modules!node!node.module/function/node_view/7

+4
source

All Articles