function RequiredContext::getOperations

Same name in other branches
  1. 8.x-3.x src/Form/RequiredContext.php \Drupal\ctools\Form\RequiredContext::getOperations()

Retrieve Form Operations

Parameters

$route_name_base: The base route name.

array $route_parameters: Route Parameters.

Return value

array The available operations.

1 call to RequiredContext::getOperations()
RequiredContext::renderContexts in src/Form/RequiredContext.php
Render The contexts in the form.

File

src/Form/RequiredContext.php, line 171

Class

RequiredContext
Required Context Form.

Namespace

Drupal\ctools\Form

Code

protected function getOperations($route_name_base, array $route_parameters = []) {
    $operations['edit'] = [
        'title' => $this->t('Edit'),
        'url' => new Url($route_name_base . '.edit', $route_parameters),
        'weight' => 10,
        'attributes' => [
            'class' => [
                'use-ajax',
            ],
            'data-accepts' => 'application/vnd.drupal-modal',
            'data-dialog-options' => json_encode([
                'width' => 700,
            ]),
        ],
        'ajax' => [
            '',
        ],
    ];
    $route_parameters['id'] = $route_parameters['context'];
    $operations['delete'] = [
        'title' => $this->t('Delete'),
        'url' => new Url($route_name_base . '.delete', $route_parameters),
        'weight' => 100,
        'attributes' => [
            'class' => [
                'use-ajax',
            ],
            'data-accepts' => 'application/vnd.drupal-modal',
            'data-dialog-options' => json_encode([
                'width' => 700,
            ]),
        ],
    ];
    return $operations;
}