I want to calculate dynamical a value and give it back in the markup without saving the newValue. I try this with:
{% set content.field_my_field[0]['#markup'] = newValue %}
This doesn`t work!
The “newValue” is given from preprocess_node in the .theme file.
Should I rewrite this directly in the preprocess function? How?
Found a solution in preprocess_node. I tried to manipulate $variables[‘node’] instead of $variables[‘content’]
function mytheme_preprocess_node(&$variables) {
$variables['content']['field_my_field'][0]['#markup'] = $newValue;
}