public function FacetListBuilder::getDefaultOperations in Facets 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/FacetListBuilder.php, line 29 
Class
- FacetListBuilder
- Builds a listing of facet entities.
Namespace
Drupal\facetsCode
public function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);
  if ($entity instanceof FacetInterface) {
    if ($entity
      ->access('update') && $entity
      ->hasLinkTemplate('edit-form')) {
      $operations['edit'] = [
        'title' => $this
          ->t('Edit'),
        'weight' => 10,
        'url' => $entity
          ->toUrl('edit-form'),
      ];
    }
    if ($entity
      ->access('update') && $entity
      ->hasLinkTemplate('settings-form')) {
      $operations['settings'] = [
        'title' => $this
          ->t('Facet settings'),
        'weight' => 20,
        'url' => $entity
          ->toUrl('settings-form'),
      ];
    }
    if ($entity
      ->access('update') && $entity
      ->hasLinkTemplate('clone-form')) {
      $operations['clone'] = [
        'title' => $this
          ->t('Clone facet'),
        'weight' => 90,
        'url' => $entity
          ->toUrl('clone-form'),
      ];
    }
    if ($entity
      ->access('delete') && $entity
      ->hasLinkTemplate('delete-form')) {
      $operations['delete'] = [
        'title' => $this
          ->t('Delete'),
        'weight' => 100,
        'url' => $entity
          ->toUrl('delete-form'),
      ];
    }
  }
  elseif ($entity instanceof FacetsSummaryInterface) {
    $operations['edit'] = [
      'title' => $this
        ->t('Edit'),
      'weight' => 10,
      'url' => $entity
        ->toUrl('edit-form'),
    ];
    if ($entity
      ->access('update') && $entity
      ->hasLinkTemplate('settings-form')) {
      $operations['settings'] = [
        'title' => $this
          ->t('Facet Summary settings'),
        'weight' => 20,
        'url' => $entity
          ->toUrl('settings-form'),
      ];
    }
    if ($entity
      ->access('delete') && $entity
      ->hasLinkTemplate('delete-form')) {
      $operations['delete'] = [
        'title' => $this
          ->t('Delete'),
        'weight' => 100,
        'url' => $entity
          ->toUrl('delete-form'),
      ];
    }
  }
  return $operations;
}