In D8 I have a form with several fields. One specific field is a number. Input widget is Integer.
This field is prevalued with hook_form_alter like:
$nid = \Drupal::request()->query->get("source"); // query string param $node = \Drupal\node\Entity\Node::load($nid); $pe_punten = $node->get('field_pe_punten')->value;
I would like to achieve that the user has no access but can see this value. To disable it I can do:
$form['field_pe_punten']['#access'] = FALSE;
But how to replace this input widget with a piece of text which says "10 points"
I red several other QA but could not find out how to do this?