You are here

public function GridStackListBuilder::getDefaultOperations in GridStack 8.2

Same name and namespace in other branches
  1. 8 modules/gridstack_ui/src/Controller/GridStackListBuilder.php \Drupal\gridstack_ui\Controller\GridStackListBuilder::getDefaultOperations()

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 ConfigEntityListBuilder::getDefaultOperations

1 call to GridStackListBuilder::getDefaultOperations()
GridStackVariantListBuilder::getDefaultOperations in modules/gridstack_ui/src/Controller/GridStackVariantListBuilder.php
Gets this list's default operations.
1 method overrides GridStackListBuilder::getDefaultOperations()
GridStackVariantListBuilder::getDefaultOperations in modules/gridstack_ui/src/Controller/GridStackVariantListBuilder.php
Gets this list's default operations.

File

modules/gridstack_ui/src/Controller/GridStackListBuilder.php, line 146

Class

GridStackListBuilder
Provides a listing of GridStack optionsets.

Namespace

Drupal\gridstack_ui\Controller

Code

public function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);
  if (isset($operations['edit'])) {
    $operations['edit']['title'] = $this
      ->t('Configure');
  }
  $operations['duplicate'] = [
    'title' => $this
      ->t('Duplicate'),
    'weight' => 15,
    'url' => $entity
      ->toUrl('duplicate-form'),
  ];
  $defaults = [
    'bootstrap',
    'default',
    'foundation',
    'frontend',
  ];
  if (in_array($entity
    ->id(), $defaults)) {
    unset($operations['delete'], $operations['edit']);
  }
  return $operations;
}