Hook node_view and content

Jul
2015
08

I was trying to remove some field collection items (with default values but only for one subfield) from a node and although everything was working fine nothing was changing. So what was i doing wrong then? Well there a "small" catch that it is not clear about the node object that is rendered inside the node_view hook. What is that? It is the $node->content array that holds all the about to be rendered elements. So if you change the $node->field_custom_a values nothing happens but if you change the $node->content['field_custom_a'] there it is! Hope that helps someone, someday :)

this is an arrow pointing back to the top of the page