I'm working in a site that has implemented the template_preprocess_field() hook. I want to change the content of a field but the code works for all the nodes except for the nodes of a content type that have a custom template (node--emploi.tpl.php
) It's strange because I have another template for the nodes of the content type named tarif (node--tarif.tpl.php
) and in this case the hook is called.
Here the piece of code inside the template node--emploi.tpl.php file:
<div class="editor">
<?php
/* At this point the body's h2 do not know what the nid is, so a quick and dirty replace will set it right. */
print preg_replace('/NO-NID[a-z0-9]*--/', $nid . '--', check_markup($field_stm_emploi_temoignage_body[0]['value'], $field_stm_emploi_temoignage_body[0]['format']));
?>
</div>
print render($content['field_foo']);
to print$content['field_foo']
or some derivative, meaning it's not being rendered through the theme system. Would need to see the template to make sure of courseprint render($content['field_foo']);
and its works fine. Please post your answer to check it as accepted ;-)