TestController.php in Drupal 8
Same filename in this branch
- 8 core/tests/Drupal/Tests/Core/Controller/TestController.php
- 8 core/modules/views/tests/modules/views_test_modal/src/Controller/TestController.php
- 8 core/modules/system/tests/modules/httpkernel_test/src/Controller/TestController.php
- 8 core/modules/system/tests/modules/off_canvas_test/src/Controller/TestController.php
- 8 core/modules/system/tests/modules/csrf_race_test/src/Controller/TestController.php
- 8 core/modules/system/tests/modules/token_test/src/Controller/TestController.php
- 8 core/modules/system/tests/modules/conneg_test/src/Controller/TestController.php
- 8 core/modules/system/tests/modules/csrf_test/src/Controller/TestController.php
- 8 core/modules/system/tests/modules/dialog_renderer_test/src/Controller/TestController.php
- 8 core/modules/contextual/tests/modules/contextual_test/src/Controller/TestController.php
Same filename and directory in other branches
Namespace
Drupal\views_test_modal\ControllerFile
core/modules/views/tests/modules/views_test_modal/src/Controller/TestController.phpView source
<?php
namespace Drupal\views_test_modal\Controller;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Url;
class TestController extends ControllerBase {
/**
* Renders a link to open the /admin/content view in a modal dialog.
*/
public function modal() {
$build = [];
$build['open_admin_content'] = [
'#type' => 'link',
'#title' => $this
->t('Administer content'),
'#url' => Url::fromUserInput('/admin/content'),
'#attributes' => [
'class' => [
'use-ajax',
],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'dialogClass' => 'views-test-modal',
'height' => '50%',
'width' => '50%',
'title' => $this
->t('Administer content'),
]),
],
'#attached' => [
'library' => [
'core/drupal.dialog.ajax',
],
],
];
return $build;
}
}
Classes
Name![]() |
Description |
---|---|
TestController |