You are here

public function FixedBlockContentListBuilder::getDefaultOperations in Fixed Block Content 8

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

File

src/FixedBlockContentListBuilder.php, line 47

Class

FixedBlockContentListBuilder
Fixed block content list handler.

Namespace

Drupal\fixed_block_content

Code

public function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);

  // Get back after fixed block edition.
  if (isset($operations['edit'])) {
    $operations['edit']['query']['destination'] = $entity
      ->toUrl('collection')
      ->toString();
  }

  // Adds the import/export operations.
  $operations['export'] = [
    'title' => $this
      ->t('Restore default content'),
    'weight' => 20,
    'url' => $entity
      ->toUrl('export-form'),
  ];
  $operations['import'] = [
    'title' => $this
      ->t('Set contents as default'),
    'weight' => 20,
    'url' => $entity
      ->toUrl('import-form'),
  ];
  return $operations;
}