You are here

public function DashboardListBuilder::getOperations in Dashboards with Layout Builder 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/DashboardListBuilder.php \Drupal\dashboards\Entity\DashboardListBuilder::getOperations()

Provides an array of information to build a list of operation links.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.

Return value

array An associative array of operation link data for this list, keyed by operation name, containing the following key-value pairs:

  • title: The localized title of the operation.
  • url: An instance of \Drupal\Core\Url for the operation URL.
  • weight: The weight of this operation.

Overrides EntityListBuilder::getOperations

File

src/Entity/DashboardListBuilder.php, line 27

Class

DashboardListBuilder
Class DashboardListBuilder.

Namespace

Drupal\dashboards\Entity

Code

public function getOperations(EntityInterface $entity) {
  $operations = [
    'view' => [
      'title' => new TranslatableMarkup('View'),
      'weight' => 1,
      'url' => Url::fromRoute('entity.dashboard.canonical', [
        'dashboard' => $entity
          ->id(),
      ]),
    ],
    'layout' => [
      'title' => new TranslatableMarkup('Manage Layout'),
      'weight' => 1,
      'url' => Url::fromRoute('layout_builder.dashboards.view', [
        'dashboard' => $entity
          ->id(),
      ]),
    ],
  ] + parent::getOperations($entity);
  return $operations;
}