You are here

public function HomeboxListBuilder::getDefaultOperations in Homebox 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/HomeboxListBuilder.php, line 43

Class

HomeboxListBuilder
Provides a listing of Homebox entities.

Namespace

Drupal\homebox

Code

public function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);
  if ($entity
    ->access('update') && $entity
    ->hasLinkTemplate('settings-form')) {
    $operations['layout'] = [
      'title' => $this
        ->t('Settings'),
      'weight' => 20,
      'url' => $this
        ->ensureDestination(Url::fromRoute('homebox.settings_form', [
        'homebox' => $entity
          ->id(),
      ])),
    ];
  }
  return $operations;
}