You are here

protected function LayoutListBuilder::getDefaultOperations in Layout builder library 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 EntityListBuilder::getDefaultOperations

File

src/Entity/LayoutListBuilder.php, line 108

Class

LayoutListBuilder
Defines a list builder for layouts.

Namespace

Drupal\layout_library\Entity

Code

protected function getDefaultOperations(EntityInterface $entity) {

  /** @var \Drupal\layout_library\Entity\Layout $entity */
  $operations = [];
  if ($this->currentUser
    ->hasPermission('administer ' . $entity
    ->getTargetEntityType() . ' display')) {
    $operations['edit'] = [
      'title' => $this
        ->t('Edit layout'),
      'weight' => 0,
      'url' => $this
        ->getLayoutBuilderUrl($entity),
    ];
  }
  return $operations + parent::getDefaultOperations($entity);
}