A textfield with #disabled = TRUE will appear greyed out, and be unchangeable.
A textfield with #input = FALSE will not send its value to $form_state['values'], and will be ignored by system_settings_form_submit().
Unfortunately, a textfield with #disabled = TRUE and #input = FALSE no longer appears greyed out.
I want to make a textfield that is purely for display purposes, so a person can copy a value from there. What is the best way to do this?
EDIT I: What I tried so far
To clarify, my starting point is code like this:
$form['thetext'] = [ '#type' => 'textfield', '#title' => t('The text'), '#disabled' => true, // This should make it greyed out - but it doesn't due to #input = false below. '#input' => false, // This should make this field ignored in $form_state['values']. '#value' => 'xyz', // Either #value or #default_value. ];
If this wasn't clear before: I really want the html output to be a textfield element. I also want to use the regular form + theme API, so that the element gets a label and wrapper div and theming like other form elements in the same form. E.g. if I would just hardcode the textfield html, it would no longer have the same classes, wrappers etc.