#1843220: Convert form AJAX to new AJAX API broke the automagical #ajax['dialog'] stuff because the page title used to be passed to the front end in a hackish sort-of-way in the old ajax_prepare_response(), and we accidentally dropped it in the new D8 ajax forms.

A temporary measure has been posted to the initial #1843220: Convert form AJAX to new AJAX API issue to fix HEAD for the moment, but I think a better solution is in order. As does the author of the relevant javascript:

    // If the requesting object wanted the response in a dialog, open that
    // dialog. However, a single server response can include multiple insert
    // commands (e.g., one for the primary content and another one for status
    // messages), but we only want to open the dialog once, so we assume that
    // only commands with a title property are dialog eligible.
    // @todo Consider whether this is overloading title inappropriately, and
    //   if so, find another way to determine dialog eligibility.
    if (ajax.dialog && ('title' in response)) {
      var dialogOptions = $.extend({title: response.title}, ajax.dialog);
      var dialog = Drupal.dialog(wrapper, dialogOptions);
      ajax.dialog.modal ? dialog.showModal() : dialog.show();


Crell’s picture

Related: #1871596: Create a PartialResponse class to encapsulate html-level data [Moving to sandbox]

If that goes in, then controllers can return a strutured object with body and title and eventually other things like new HTML link tags. The AjaxController should be able to dissect that and turn it into the appropriate set of InsertCommand objects, or whatever else we want.

catch’s picture

jibran’s picture

Issue tags: +modal dialog


jessebeach’s picture

Title: Figure out a better way to get the page title to a the modal dialog » Figure out a better way to get the page title to a modal dialog

Removed a spurious "the" from the issue title.

dawehner’s picture

#2100073-11: Convert local_actions to the new local action plugins has some code to use the title resolver introduced in some issue.

mgifford’s picture

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

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