When a drupal form is opened in a dialog, the submit buttons are automatically turned into jquery ui dialog buttons.

Sometimes this is not wanted and the drupalAutoButtons options is supposed to control if this is needed or not. Setting this at FALSE from the PHP doesn't do anything, buttons are still created.

Patch fixes the missing js that makes this option work as expected. This can be tested with the outside-in module. Before patch submit buttons are at the bottom of the dialog styled like jQuery dialog buttons, after the patch they're regular form submit buttons.



nod_ created an issue. See original summary.

droplet’s picture

Status: Needs review » Reviewed & tested by the community

Good to see it's optional :)

tim.plunkett’s picture

Title: fix dialog drupalAutoButtons option » Dialog drupalAutoButtons option should be respected on initial load

It works for new content loaded in, amusingly enough. Just not for the initial dialog content.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

We should be able to test this now.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

finnsky’s picture

747 bytes

Hi all!
I met that issue when tried to manage webform inside dialog. Smth like:

      $data_dialog_options = [
        'drupalAutoButtons' => FALSE,
        'width' => 768,
        'height' => 'auto',
        'position' => ['my' => 'top+260', 'at' => 'top'],
      $variables['options']['attributes']['data-dialog-options'] = Json::encode($data_dialog_options);

I wanted to have submit button inside webform instead dialog one.
In html that dialog link looks ok:
https://www.drupal.org/files/issues/core-js-dialog-autobuttons.patch failed for me. My issue was because that FALSE option appears as string not boolean. It happends after AJAX submit.
That patch helped. But that issue needs some work still.

andypost’s picture

Issue tags: +JavaScript

It definitely needs tests

andypost’s picture

Version: 8.3.x-dev » 8.4.x-dev

I'm sure better to find a cause of type conversion for settings withing drupal.ajax

+++ b/core/misc/dialog/dialog.ajax.js
@@ -130,9 +130,11 @@
+    if (!response.dialogOptions.drupalAutoButtons || response.dialogOptions.drupalAutoButtons !== 'false') {

when boolean converted to string?