You are here

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

Get the operations.

Parameters

mixed $cached_values: The arbitrary value from temporary storage.

string $row: The row.

string $route_name_base: The base of route.

array $route_parameters: The parameters of route.

Return value

mixed The operations.

1 call to ManageResolverRelationships::getOperations()
ManageResolverRelationships::renderRows in src/Form/ManageResolverRelationships.php
Render the rows.

File

src/Form/ManageResolverRelationships.php, line 210

Class

ManageResolverRelationships
Provider manage resolver relationships.

Namespace

Drupal\ctools\Form

Code

protected function getOperations($cached_values, $row, $route_name_base, array $route_parameters = []) {

  // Base contexts will not be a :
  // separated and generated relationships should have 3 parts.
  if (count(explode(':', $row)) < 2) {
    return [];
  }
  $operations['edit'] = [
    'title' => $this
      ->t('Edit'),
    'url' => new Url($route_name_base . '.edit', $route_parameters),
    'weight' => 10,
    'attributes' => [
      'class' => [
        'use-ajax',
      ],
      'data-dialog-type' => 'modal',
      'data-dialog-options' => Json::encode([
        'width' => 700,
      ]),
    ],
  ];
  $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-dialog-type' => 'modal',
      'data-dialog-options' => Json::encode([
        'width' => 700,
      ]),
    ],
  ];
  return $operations;
}