Dec 16, 2020 in Drupal 8

The Form API changed a bit over the years. This is the way add a html field to a form in drupal 8 & 9.

$form['price'] = [
   '#markup' => '<h2>' . $node->get('field_price')->getString() . '$</h2>',
];

 

Comments