This very popular article explains correct way to render fields: http://www.computerminds.co.uk/articles/rendering-drupal-7-fields-right-way
According to the article, the correct way to render fields is like this:
$node = node_load($nid); $field = field_get_items('node', $node, 'field_name'); $output = field_view_value('node', $node, 'field_name', $field[$delta]);
But this is for rendering fields that are stored in a node. How would you use the code for fields in an entity?
I am using Paragraphs module that lets you create custom bundles in the predefined "paragraph" entity.
You can use
entity.tpl.php to override the output of Paragraph module fields.
I want to print my fields that are stored in the entity, but the above code won't work because it is for nodes.