public function GridStackVariantListBuilder::getDefaultOperations in GridStack 8.2
Gets this list's default operations.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.
Return value
array The array structure is identical to the return value of self::getOperations().
Overrides GridStackListBuilder::getDefaultOperations
File
- modules/
gridstack_ui/ src/ Controller/ GridStackVariantListBuilder.php, line 53
Class
- GridStackVariantListBuilder
- Provides a listing of GridStack optionsets.
Namespace
Drupal\gridstack_ui\ControllerCode
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
if (isset($operations['duplicate'])) {
unset($operations['duplicate']);
}
$operations['edit'] = [
'title' => $this
->t('Configure'),
'url' => $entity
->toUrl('edit-form'),
];
$operations['delete'] = [
'title' => $this
->t('Delete'),
'url' => $entity
->toUrl('delete-form'),
];
$access = $this->currentUser
->hasPermission('administer gridstack');
if ($access && ($gridstack = $entity
->getOptionset())) {
$operations['source'] = [
'title' => $this
->t('Source'),
'url' => $gridstack
->toUrl('edit-form'),
];
}
return $operations;
}