You are here

public function GathercontentMappingListBuilder::getDefaultOperations in GatherContent 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/GathercontentMappingListBuilder.php, line 111

Class

GathercontentMappingListBuilder
Provides a listing of GatherContent Mapping entities.

Namespace

Drupal\gathercontent

Code

public function getDefaultOperations(EntityInterface $entity) {
  if ($entity
    ->access('update') && $entity
    ->hasLinkTemplate('edit-form')) {
    $operations['edit'] = array(
      'title' => $entity
        ->hasMapping() ? $this
        ->t('Edit') : $this
        ->t('Setup'),
      'weight' => 10,
      'url' => $entity
        ->urlInfo('edit-form'),
    );
  }
  if ($entity
    ->access('delete') && $entity
    ->hasLinkTemplate('delete-form')) {
    $operations['delete'] = array(
      'title' => $this
        ->t('Delete'),
      'weight' => 100,
      'url' => $entity
        ->urlInfo('delete-form'),
    );
  }
  return $operations;
}