How to disable input field but show tekst with hook_form_alter? 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()-&gt;query-&gt;get("source"); // query string param
$node    = \Drupal\node\Entity\Node::load($nid);
$pe_punten = $node-&gt;get('field_pe_punten')-&gt;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?
use #disabled like below:

$form['field_pe_punten']['#disabled'] = 'disabled';