I am trying to build a questionnaire that simply replaces (alters) the label of a list field. I am doing so by replacing a token from views (embed) and implementing hook_form_alter()
in a separate module.
How can I save that value and write it to the database? I am using an Entity form and a list-field.
This is the snippet I am struggling with, found on Store token replacement values in the database rather than tokens themselves.
function question_to_label_node_presave($node) {
if ($node->type == 'page') {
$replaced_text = token_replace($node->field_question['und'][0]['value']);
$node->field_question['und'][0]['value'] = $replaced_text;
}
}
I am currently trying to run this in a custom module, but I cannot find the right content type for the Entity form. I am using the Devel module to find the right array value.