function TestController::modal
Same name in other branches
- 9 core/modules/views/tests/modules/views_test_modal/src/Controller/TestController.php \Drupal\views_test_modal\Controller\TestController::modal()
- 10 core/modules/views/tests/modules/views_test_modal/src/Controller/TestController.php \Drupal\views_test_modal\Controller\TestController::modal()
- 11.x core/modules/views/tests/modules/views_test_modal/src/Controller/TestController.php \Drupal\views_test_modal\Controller\TestController::modal()
Renders a link to open the /admin/content view in a modal dialog.
1 string reference to 'TestController::modal'
- views_test_modal.routing.yml in core/
modules/ views/ tests/ modules/ views_test_modal/ views_test_modal.routing.yml - core/modules/views/tests/modules/views_test_modal/views_test_modal.routing.yml
File
-
core/
modules/ views/ tests/ modules/ views_test_modal/ src/ Controller/ TestController.php, line 14
Class
Namespace
Drupal\views_test_modal\ControllerCode
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.