I have field "myfield" in a node. The field is created in the content, not by hook. I want to change the value of that field. I do not want to display the value from database, but my value let's say random number. I tried to do this with hook_node_view and with hook_entity_view but I cannot change it on the display. Here is my code:
function mymodule_node_view($node, $view_mode) {
if ($node->type == 'my_node_type') {
if ($node->nid == 46) {
$node->myfield['und'][0]['value'] = 55;
//or I tried with $node->content and no success
}
}
}
What am I missing? Can you help me, please! Thanks you in advance!