You can add an extra field to a Drupal entity via hook like it is described here: https://gorannikolovski.com/blog/display-and-form-pseudo-fields-drupal-8...
There is one caveat to this explanation. If you use field groups to group such extra fields you need to put them into a container (at least for the form extra fields), otherwise they will not show inside the field group.
So instead of this
$form['field_thank_you'] = [
'#type' => 'markup',
'#markup' => 'Thanks'
];
use
$form['field_thank_you'] = [
'#type' => 'container'
];
$form['field_thank_you']['message'] = [
'#type' => 'markup',
'#markup' => 'Thanks'
];
Neuen Kommentar schreiben