Commit 2dfecb5e authored by webchick's avatar webchick
Browse files

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

parent ead42d38
......@@ -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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment