You are here

protected function TaskListBuilder::getDefaultOperations in General Data Protection Regulation 8

Same name and namespace in other branches
  1. 8.2 modules/gdpr_tasks/src/TaskListBuilder.php \Drupal\gdpr_tasks\TaskListBuilder::getDefaultOperations()
  2. 3.0.x modules/gdpr_tasks/src/TaskListBuilder.php \Drupal\gdpr_tasks\TaskListBuilder::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

modules/gdpr_tasks/src/TaskListBuilder.php, line 93

Class

TaskListBuilder
Defines a class to build a listing of Task entities.

Namespace

Drupal\gdpr_tasks

Code

protected function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);
  if ($entity
    ->access('view') && $entity
    ->hasLinkTemplate('canonical')) {
    $operations['view'] = [
      'title' => $this
        ->t('View'),
      'weight' => 0,
      'url' => $this
        ->ensureDestination($entity
        ->toUrl()),
    ];
  }
  return $operations;
}