Create custom display of element using field values Lets say I have a Company content type that contains the following fields:


Company Name 
Company Description 
Company Logo Image
Company Website URL


I use the Entity Reference module to relate companies to Articles. When displaying an article page I would like to show the company logo which should link to the URL with the description on-hover. If I were using a view I'd do a rewrite for something like this:

&lt;a href="[Company-Website-URL]"&gt;[Company-Logo-Image]&lt;/a&gt;
&lt;div class="tooltip"&gt;[Company-Description]&lt;/div&gt;


How could I do something similar for the actual individual article page?
I assume you have an entity reference field "Company" in the content type "Article". You could implement hook_node_view() to achieve this on the individual article node page. Check the following example code:

function mymodule_node_view($node, $view_mode = 'full', $langcode = NULL) {
    if($view_mode == 'full'){       
        if( $node-&gt;type == 'article' ){
            // load the entity reference 'company' in full
            $company = node_load($node-&gt;field_company[LANGUAGE_NONE][0]['target_id']);

            $logo        = $company-&gt;field_logo[LANGUAGE_NONE][0]['uri'];
            $logo        = '&lt;img src="'.file_create_url($logo).'" /&gt;';
            $website     = $company-&gt;field_website[LANGUAGE_NONE][0]['safe_value'];
            $description = $company-&gt;body[LANGUAGE_NONE][0]['safe_value'];
            // delete the default entity reference display
            unset($node-&gt;content['field_company']);
            // add the company logo to the node view
            $node-&gt;content['logo'] = array(
                '#markup' =&gt; l($logo, $website, array('html'=&gt;TRUE))                
            );
            // add the company description to the node view
            $node-&gt;content['tooltip'] = array(
                '#markup' =&gt; '&lt;div class="tooltip"&gt;'.$description.'&lt;/div&gt;'
            );

        }
    }   
}


API reference for functions used in the hook.  


node_load   
file_create_url  
l