You are here

protected function EntityBrowserListBuilder::getDefaultOperations in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/Controllers/EntityBrowserListBuilder.php \Drupal\entity_browser\Controllers\EntityBrowserListBuilder::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 EntityListBuilder::getDefaultOperations

File

src/Controllers/EntityBrowserListBuilder.php, line 42

Class

EntityBrowserListBuilder
Provides a list controller for entity browser.

Namespace

Drupal\entity_browser\Controllers

Code

protected function getDefaultOperations(EntityInterface $entity) {
  if ($entity
    ->access('update')) {
    $operations['edit'] = [
      'title' => $this
        ->t('Edit'),
      'url' => $entity
        ->toUrl('edit-form'),
    ];
  }
  $operations['edit-widgets'] = [
    'title' => $this
      ->t('Edit Widgets'),
    'url' => $entity
      ->toUrl('edit-widgets'),
  ];
  if ($entity
    ->access('delete')) {
    $operations['delete'] = [
      'title' => $this
        ->t('Delete'),
      'url' => $entity
        ->toUrl('delete-form'),
      'weight' => 100,
    ];
  }
  return $operations;
}