You are here

protected function RequiredContext::getOperations in Chaos Tool Suite (ctools) 8.3

1 call to RequiredContext::getOperations()
RequiredContext::renderContexts in src/Form/RequiredContext.php

File

src/Form/RequiredContext.php, line 148

Class

RequiredContext

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;
}