Skip to content
Snippets Groups Projects
Commit 2dfecb5e authored by Angie Byron's avatar Angie Byron
Browse files

Issue #1987644 by mparker17, dawehner: Convert common_test_destination() to a new style controller.

parent ead42d38
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -5,27 +5,6 @@
* Helper module for the Common tests.
*/
/**
* Implements hook_menu().
*/
function common_test_menu() {
$items['common-test/destination'] = array(
'title' => 'Drupal Get Destination',
'page callback' => 'common_test_destination',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
* Prints a destination query parameter.
*/
function common_test_destination() {
$destination = drupal_get_destination();
print "The destination: " . check_plain($destination['destination']);
}
/**
* Applies #printed to an element to help test #pre_render.
*/
......
......@@ -4,6 +4,12 @@ common_test_l_active_class:
_content: '\Drupal\common_test\Controller\CommonTestController::typeLinkActiveClass'
requirements:
_access: 'TRUE'
common_test_destination:
pattern: '/common-test/destination'
defaults:
_controller: '\Drupal\common_test\Controller\CommonTestController::destination'
requirements:
_permission: 'access content'
common_test_drupal_render_invalid_keys:
pattern: 'common-test/drupal-render-invalid-keys'
defaults:
......
......@@ -7,8 +7,10 @@
namespace Drupal\common_test\Controller;
use Drupal\Component\Utility\String;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
/**
* Controller routines for common_test routes.
......@@ -88,4 +90,18 @@ public function jsAndCssQuerystring() {
return '';
}
/**
* Prints a destination query parameter.
*
* @return \Symfony\Component\HttpFoundation\Response
* A new Response object containing a string with the destination query
* parameter.
*/
public function destination() {
$destination = drupal_get_destination();
$output = "The destination: " . String::checkPlain($destination['destination']);
return new Response($output);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment