You are here

public function MailingListListBuilder::getOperations in Mailing List 8

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/MailingListListBuilder.php, line 46

Class

MailingListListBuilder
Defines a class to build a listing of mailing list entities.

Namespace

Drupal\mailing_list

Code

public function getOperations(EntityInterface $entity) {
  $operations = parent::getOperations($entity);
  $operations['export'] = [
    'title' => $this
      ->t('Export e-mail addresses'),
    'url' => Url::fromRoute('entity.mailing_list.export', [
      'mailing_list' => $entity
        ->id(),
    ]),
  ];
  $operations['import'] = [
    'title' => $this
      ->t('Import e-mail addresses'),
    'url' => Url::fromRoute('entity.mailing_list.import', [
      'mailing_list' => $entity
        ->id(),
    ]),
  ];
  return $operations;
}