Adding a simple "Cancel" button to a form, which points to a route is easy, but you have to know how: $form['actions']['cancel'] = [ '#type' => 'link', '#title' => t('Cancel'), '#attributes' => [ 'class' => [ 'button', 'button--danger',
Snippets
Drupal Form API doesn't offer a native HTML type="reset" button known from the W3C: https://www.w3.org/TR/2012/WD-html-markup-20121025/input.reset.html So if you ever need one, this might be a good starting point in Drupal 8+: 'reset' => [
As it sadly took me some time to find out and it's not very well documented, here's how you close a Drupal 8+ dialog (in this case the Off-Canvas) using JavaScript: Drupal.dialog(document.getElementById('drupal-off-canvas')).close(); You
In the COOKiES Drupal 8+ module, we had the issue that config entity string translations were not possible with text > 128 characters length: https://www.drupal.org/project/cookies/issues/3327045 The reason for that is in core. Form API
This post saved you a lot of time and headache?
Then I'd be very happy about a delicious coffee! Or a helpful book from my wish list.