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()
- 8.9.x 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()
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 16
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([
'classes' => [
'ui-dialog' => '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.