Issue #1987734 by InternetDevels, ramlev, juampy: Convert menu_login_callback() to a new style controller.
parent
1cb6503284
commit
35ab9aef9c
|
@ -190,7 +190,7 @@ class MenuRouterTest extends WebTestBase {
|
|||
$this->drupalGet('test-page');
|
||||
$this->assertText($offline_message);
|
||||
$this->drupalGet('menu_login_callback');
|
||||
$this->assertText('This is menu_login_callback().', 'Maintenance mode can be bypassed using an event subscriber.');
|
||||
$this->assertText('This is TestControllers::testLogin.', 'Maintenance mode can be bypassed using an event subscriber.');
|
||||
|
||||
config('system.maintenance')->set('enabled', 0)->save();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,13 @@ use Drupal\Core\Entity\EntityInterface;
|
|||
*/
|
||||
class TestControllers {
|
||||
|
||||
/**
|
||||
* Returns page to be used as a login path.
|
||||
*/
|
||||
public function testLogin() {
|
||||
return 'This is TestControllers::testLogin.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out test data.
|
||||
*/
|
||||
|
|
|
@ -311,13 +311,6 @@ function menu_test_menu() {
|
|||
'access arguments' => array('access content'),
|
||||
);
|
||||
|
||||
// Test the access key with a function callback.
|
||||
$items['menu_login_callback'] = array(
|
||||
'title' => 'Used as a login path',
|
||||
'page callback' => 'menu_login_callback',
|
||||
'access callback' => TRUE,
|
||||
);
|
||||
|
||||
// Test the access key.
|
||||
$items['menu-title-test/case1'] = array(
|
||||
'title' => 'Example title - Case 1',
|
||||
|
@ -726,18 +719,6 @@ function menu_test_static_variable($value = NULL) {
|
|||
return $variable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page callback: Provides a login path.
|
||||
*
|
||||
* @return string
|
||||
* A text string that can be used for comparison.
|
||||
*
|
||||
* @see menu_test_menu().
|
||||
*/
|
||||
function menu_login_callback() {
|
||||
return 'This is menu_login_callback().';
|
||||
}
|
||||
|
||||
/**
|
||||
* Title callback: Concatenates the title and case number.
|
||||
*
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
menu_login_callback:
|
||||
pattern: '/menu_login_callback'
|
||||
defaults:
|
||||
_content: '\Drupal\menu_test\TestControllers::testLogin'
|
||||
requirements:
|
||||
_access: 'TRUE'
|
||||
menu_router_test1:
|
||||
pattern: '/foo/{bar}'
|
||||
defaults:
|
||||
|
|
Loading…
Reference in New Issue