3 namespace Drupal\views_test_modal\Controller;
5 use Drupal\Component\Serialization\Json;
6 use Drupal\Core\Controller\ControllerBase;
9 class TestController extends ControllerBase {
12 * Renders a link to open the /admin/content view in a modal dialog.
14 public function modal() {
17 $build['open_admin_content'] = [
19 '#title' => $this->t('Administer content'),
20 '#url' => Url::fromUserInput('/admin/content'),
22 'class' => ['use-ajax'],
23 'data-dialog-type' => 'modal',
24 'data-dialog-options' => Json::encode([
25 'dialogClass' => 'views-test-modal',
28 'title' => $this->t('Administer content'),
33 'core/drupal.dialog.ajax',