How to display just the label from the object returned by the function node_load(). the field_view_field() can hide the label and view the value but i want the converse.
1 Answer
If you want to find the label for a specific field then you can use field_info_instance()
https://api.drupal.org/api/drupal/modules!field!field.info.inc/function/field_info_instance/7
<?php
$field_instance = field_info_instance('node', 'field_body', 'article');
$label = $field_instance['label'];
?>
However, the titles are available in the rendered node if they are not hidden in your view mode, and can accessed like :
<?php
$node = node_view(node_load($nid));
$label = $node['field_body']['#title'];
?>
-
i found this pretty short: <?=render($content['field_address']['#title'])?> inside the node.tpl.php thanks for your support Commented Nov 16, 2014 at 23:28