DisplayModeLocalAction.php

Same filename in other branches
  1. 10 core/modules/field_ui/src/DisplayModeLocalAction.php

Namespace

Drupal\field_ui

File

core/modules/field_ui/src/DisplayModeLocalAction.php

View source
<?php

namespace Drupal\field_ui;

use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Menu\LocalActionDefault;
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Defines a local action plugin with modal dialog.
 */
class DisplayModeLocalAction extends LocalActionDefault {
    
    /**
     * {@inheritdoc}
     */
    public function getOptions(RouteMatchInterface $route_match) {
        $options = parent::getOptions($route_match);
        $options = NestedArray::mergeDeepArray([
            [
                'attributes' => [
                    'class' => [
                        'button',
                        'use-ajax',
                    ],
                    'data-dialog-type' => 'modal',
                    'data-dialog-options' => Json::encode([
                        'width' => '880',
                    ]),
                ],
            ],
            $options,
        ]);
        return $options;
    }

}

Classes

Title Deprecated Summary
DisplayModeLocalAction Defines a local action plugin with modal dialog.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.