diff --git a/core/modules/system/tests/modules/ajax_test/ajax_test.module b/core/modules/system/tests/modules/ajax_test/ajax_test.module deleted file mode 100644 index de741fe..0000000 --- a/core/modules/system/tests/modules/ajax_test/ajax_test.module +++ /dev/null @@ -1,40 +0,0 @@ -query; - if ($query->has('message')) { - $message = $query->get('message'); - } - $response = new AjaxResponse(); - $response->addCommand(new AlertCommand($message)); - return $response; -} - -/** - * Menu callback: Close the ajax dialog. - * - * @deprecated \Drupal\ajax_test\Controller\AjaxTestController::dialogClose() - */ -function ajax_test_dialog_close() { - $response = new AjaxResponse(); - $response->addCommand(new CloseDialogCommand('#ajax-test-dialog-wrapper-1')); - return $response; -} diff --git a/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php b/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php index 928b84e..9279b0d 100644 --- a/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php +++ b/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php @@ -8,8 +8,11 @@ namespace Drupal\ajax_test\Controller; use Drupal\Core\Ajax\AjaxResponse; +use Drupal\Core\Ajax\AlertCommand; +use Drupal\Core\Ajax\CloseDialogCommand; use Drupal\Core\Ajax\HtmlCommand; use Drupal\Core\Url; +use Symfony\Component\HttpFoundation\Request; /** * Provides content for dialog tests. @@ -80,14 +83,27 @@ public function order() { } /** - * @todo Remove ajax_test_error(). + * Menu callback: Returns AJAX element with #error property set. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * The current request object. + * + * @return \Drupal\Core\Ajax\AjaxResponse + * The JSON response object. */ - public function renderError() { - return ajax_test_error(); + public function renderError(Request $request) { + $message = ''; + $query = $request->query; + if ($query->has('message')) { + $message = $query->get('message'); + } + $response = new AjaxResponse(); + $response->addCommand(new AlertCommand($message)); + return $response; } /** - * @todo Remove ajax_test_dialog(). + * Menu callback: Renders a form elements and links with #ajax['dialog']. */ public function dialog() { // Add two wrapper elements for testing non-modal dialogs. Modal dialogs use @@ -180,10 +196,15 @@ public function dialog() { } /** - * @todo Remove ajax_test_dialog_close(). + * Close the ajax dialog. + * + * @return \Drupal\Core\Ajax\AjaxResponse $response + * The JSON response object. */ public function dialogClose() { - return ajax_test_dialog_close(); + $response = new AjaxResponse(); + $response->addCommand(new CloseDialogCommand('#ajax-test-dialog-wrapper-1')); + return $response; } }