function ManageResolverRelationships::getOperations

Same name and namespace in other branches
  1. 4.0.x src/Form/ManageResolverRelationships.php \Drupal\ctools\Form\ManageResolverRelationships::getOperations()

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