You are here

public function DirectoryListBuilder::getDefaultOperations in Private files download permission 8.2

Same name and namespace in other branches
  1. 3.x src/DirectoryListBuilder.php \Drupal\pfdp\DirectoryListBuilder::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 ConfigEntityListBuilder::getDefaultOperations

File

src/DirectoryListBuilder.php, line 102

Class

DirectoryListBuilder
Defines a class to build a list of Private files download permission directory entities.

Namespace

Drupal\pfdp

Code

public function getDefaultOperations(EntityInterface $entity) {
  $pfdp_directory = $entity;

  // Prepare the table row operations for the directory.
  $operations = parent::getDefaultOperations($pfdp_directory);
  if ($pfdp_directory
    ->hasLinkTemplate('edit')) {
    $operations['edit'] = [
      'title' => t('Edit directory'),
      'weight' => 20,
      'url' => $pfdp_directory
        ->toUrl('edit'),
    ];
  }
  if ($pfdp_directory
    ->hasLinkTemplate('delete')) {
    $operations['delete'] = [
      'title' => t('Delete directory'),
      'weight' => 40,
      'url' => $pfdp_directory
        ->toUrl('delete'),
    ];
  }

  // Return the table row operations.
  return $operations;
}