diff --git a/core/modules/system/tests/modules/ajax_test/ajax_test.module b/core/modules/system/tests/modules/ajax_test/ajax_test.module index 802b34e..1c94a31 100644 --- a/core/modules/system/tests/modules/ajax_test/ajax_test.module +++ b/core/modules/system/tests/modules/ajax_test/ajax_test.module @@ -87,100 +87,6 @@ function ajax_test_error() { } /** - * Menu callback: Renders a form elements and links with #ajax['dialog']. - * - * @deprecated \Drupal\ajax_test\Controller\AjaxTestController::dialog() - */ -function ajax_test_dialog() { - // Add two wrapper elements for testing non-modal dialogs. Modal dialogs use - // the global drupal-modal wrapper by default. - $build['dialog_wrappers'] = array('#markup' => '
'); - - // Dialog behavior applied to a button. - $build['form'] = drupal_get_form('ajax_test_dialog_form'); - - // Dialog behavior applied to a #type => 'link'. - $build['link'] = array( - '#type' => 'link', - '#title' => 'Link 1 (modal)', - '#href' => 'ajax-test/dialog-contents', - '#attributes' => array( - 'class' => array('use-ajax'), - 'data-accepts' => 'application/vnd.drupal-modal', - ), - ); - - // Dialog behavior applied to links rendered by theme_links(). - $build['links'] = array( - '#theme' => 'links', - '#links' => array( - 'link2' => array( - 'title' => 'Link 2 (modal)', - 'href' => 'ajax-test/dialog-contents', - 'attributes' => array( - 'class' => array('use-ajax'), - 'data-accepts' => 'application/vnd.drupal-modal', - 'data-dialog-options' => json_encode(array( - 'width' => 400, - )) - ), - ), - 'link3' => array( - 'title' => 'Link 3 (non-modal)', - 'href' => 'ajax-test/dialog-contents', - 'attributes' => array( - 'class' => array('use-ajax'), - 'data-accepts' => 'application/vnd.drupal-dialog', - 'data-dialog-options' => json_encode(array( - 'target' => 'ajax-test-dialog-wrapper-1', - 'width' => 800, - )) - ), - ), - 'link4' => array( - 'title' => 'Link 4 (close non-modal if open)', - 'href' => 'ajax-test/dialog-close', - 'attributes' => array( - 'class' => array('use-ajax'), - ), - ), - 'link5' => array( - 'title' => 'Link 5 (form)', - 'href' => 'ajax-test/dialog-form', - 'attributes' => array( - 'class' => array('use-ajax'), - 'data-accepts' => 'application/vnd.drupal-modal', - ), - ), - 'link6' => array( - 'title' => 'Link 6 (entity form)', - 'href' => 'admin/structure/contact/add', - 'attributes' => array( - 'class' => array('use-ajax'), - 'data-accepts' => 'application/vnd.drupal-modal', - 'data-dialog-options' => json_encode(array( - 'width' => 800, - 'height' => 500, - )) - ), - ), - 'link7' => array( - 'title' => 'Link 7 (non-modal, no target)', - 'href' => 'ajax-test/dialog-contents', - 'attributes' => array( - 'class' => array('use-ajax'), - 'data-accepts' => 'application/vnd.drupal-dialog', - 'data-dialog-options' => json_encode(array( - 'width' => 800, - )) - ), - ), - ), - ); - return $build; -} - -/** * Form builder: Renders buttons with #ajax['dialog']. */ function ajax_test_dialog_form($form, &$form_state) { diff --git a/core/modules/system/tests/modules/ajax_test/lib/Drupal/ajax_test/Controller/AjaxTestController.php b/core/modules/system/tests/modules/ajax_test/lib/Drupal/ajax_test/Controller/AjaxTestController.php index d0387ef..0a6f652 100644 --- a/core/modules/system/tests/modules/ajax_test/lib/Drupal/ajax_test/Controller/AjaxTestController.php +++ b/core/modules/system/tests/modules/ajax_test/lib/Drupal/ajax_test/Controller/AjaxTestController.php @@ -43,10 +43,96 @@ public function renderError() { } /** - * @todo Remove ajax_test_dialog(). + * Renders a form elements and links with #ajax['dialog']. */ public function dialog() { - return ajax_test_dialog(); + // Add two wrapper elements for testing non-modal dialogs. Modal dialogs use + // the global drupal-modal wrapper by default. + $build['dialog_wrappers'] = array('#markup' => '
'); + + // Dialog behavior applied to a button. + $build['form'] = drupal_get_form('ajax_test_dialog_form'); + + // Dialog behavior applied to a #type => 'link'. + $build['link'] = array( + '#type' => 'link', + '#title' => 'Link 1 (modal)', + '#href' => 'ajax-test/dialog-contents', + '#attributes' => array( + 'class' => array('use-ajax'), + 'data-accepts' => 'application/vnd.drupal-modal', + ), + ); + + // Dialog behavior applied to links rendered by theme_links(). + $build['links'] = array( + '#theme' => 'links', + '#links' => array( + 'link2' => array( + 'title' => 'Link 2 (modal)', + 'href' => 'ajax-test/dialog-contents', + 'attributes' => array( + 'class' => array('use-ajax'), + 'data-accepts' => 'application/vnd.drupal-modal', + 'data-dialog-options' => json_encode(array( + 'width' => 400, + )) + ), + ), + 'link3' => array( + 'title' => 'Link 3 (non-modal)', + 'href' => 'ajax-test/dialog-contents', + 'attributes' => array( + 'class' => array('use-ajax'), + 'data-accepts' => 'application/vnd.drupal-dialog', + 'data-dialog-options' => json_encode(array( + 'target' => 'ajax-test-dialog-wrapper-1', + 'width' => 800, + )) + ), + ), + 'link4' => array( + 'title' => 'Link 4 (close non-modal if open)', + 'href' => 'ajax-test/dialog-close', + 'attributes' => array( + 'class' => array('use-ajax'), + ), + ), + 'link5' => array( + 'title' => 'Link 5 (form)', + 'href' => 'ajax-test/dialog-form', + 'attributes' => array( + 'class' => array('use-ajax'), + 'data-accepts' => 'application/vnd.drupal-modal', + ), + ), + 'link6' => array( + 'title' => 'Link 6 (entity form)', + 'href' => 'admin/structure/contact/add', + 'attributes' => array( + 'class' => array('use-ajax'), + 'data-accepts' => 'application/vnd.drupal-modal', + 'data-dialog-options' => json_encode(array( + 'width' => 800, + 'height' => 500, + )) + ), + ), + 'link7' => array( + 'title' => 'Link 7 (non-modal, no target)', + 'href' => 'ajax-test/dialog-contents', + 'attributes' => array( + 'class' => array('use-ajax'), + 'data-accepts' => 'application/vnd.drupal-dialog', + 'data-dialog-options' => json_encode(array( + 'width' => 800, + )) + ), + ), + ), + ); + + return $build; } /**