function ManageContext::getOperations
Same name in other branches
- 4.0.x src/Form/ManageContext.php \Drupal\ctools\Form\ManageContext::getOperations()
Get available Operations.
Parameters
array $cached_values: The cached context values.
string $row: The row operations are being fetched from.
string $route_name_base: The route name.
array $route_parameters: Parameters for the route.
Return value
mixed The operations.
1 call to ManageContext::getOperations()
- ManageContext::renderRows in src/
Form/ ManageContext.php - Render the Rows.
File
-
src/
Form/ ManageContext.php, line 296
Class
- ManageContext
- Manage Context Form.
Namespace
Drupal\ctools\FormCode
protected function getOperations(array $cached_values, string $row, string $route_name_base, array $route_parameters = []) {
$operations = [];
if ($this->isEditableContext($cached_values, $row)) {
$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,
]),
],
];
$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;
}