Hot answers tagged

2

It turns out the code above was working fine -- the problem was that the site was using a Bootstrap subtheme, and Bootstrap was configured to override the standard dialog behavior. Turning off Bootstrap's dialogs solved the problem, enabling both width and title settings.


1

I doubt that the array you've found really assigns 2 callbacks. It's rather an array defining a class and a method for a single callback: 'callback' => ['Drupal\foo\BarClass', 'ajaxCallback'] In fact, you can only set one callback in an #ajax element. If you want to override a callback you have to include the overridden callback in your code: Drupal\foo\...


1

This works for me: $element = NULL; if (!empty($triggering_element['#ajax']['element'])) { $element = \Drupal\Component\Utility\NestedArray::getValue($form, $triggering_element['#ajax']['element']); } // Element not specified or not found. Show messages on top of the form. if (!$element) { $element = $form; } $response = new AjaxResponse(); $response->...


Only top voted, non community-wiki answers of a minimum length are eligible