function TestModalController::modal
Renders a link to open pager_test.multiple_pagers in a modal dialog.
1 string reference to 'TestModalController::modal'
- pager_test.routing.yml in core/
modules/ system/ tests/ modules/ pager_test/ pager_test.routing.yml - core/modules/system/tests/modules/pager_test/pager_test.routing.yml
File
-
core/
modules/ system/ tests/ modules/ pager_test/ src/ Controller/ TestModalController.php, line 19
Class
- TestModalController
- Renders a link to open a route in route with a pager in a modal.
Namespace
Drupal\pager_test\ControllerCode
public function modal() : array {
$build = [];
$build['open_pager_link'] = [
'#type' => 'link',
'#title' => $this->t('Open modal'),
'#url' => Url::fromRoute('pager_test.multiple_pagers'),
'#attributes' => [
'class' => [
'use-ajax',
],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'dialogClass' => 'pager-test-modal',
'height' => '50%',
'width' => '50%',
'title' => $this->t('Pagers in modal'),
]),
],
'#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.