How to add html tag in a form element drupal 8?
$form['buttons']['submit'] = [
'#type' => 'submit',
'#value' => T('Send'),
'#prefix' => '<div class="modal-footer">',
'#suffix' => '<button type="button" class="btn btn-sm btn-default" data-dismiss="modal">' . $this->t('Close') . '</button></div>',
'#attributes' => [
'class' => ['btn-success'],
]
];
I try to add allowed_tags:
$form['buttons']['submit'] = [
'#type' => 'submit',
'#value' => T('Send'),
'#prefix' => '<div class="modal-footer">',
'#suffix' => '<button type="button" class="btn btn-sm btn-default" data-dismiss="modal">' . $this->t('Close') . '</button></div>',
'#allowed_tags' => ['button'],
'#attributes' => [
'class' => ['btn-success'],
]
];
OR
$form['buttons']['#allowed_tags'] = ['button'];
$form['#allowed_tags'] = ['button'];
Not working... Help me please!