You are here

public function ScheduleListBuilder::getOperations in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/ScheduleListBuilder.php \Drupal\business_rules\ScheduleListBuilder::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/ScheduleListBuilder.php, line 81

Class

ScheduleListBuilder
Defines a class to build a listing of Schedule entities.

Namespace

Drupal\business_rules

Code

public function getOperations(EntityInterface $entity) {
  $operations = parent::getOperations($entity);
  $operations['execute'] = [
    'title' => $this
      ->t('Execute'),
    'url' => Url::fromRoute('entity.business_rules_schedule.execute', [
      'business_rules_schedule' => $entity
        ->id(),
    ]),
    'weight' => 20,
  ];
  uasort($operations, '\\Drupal\\Component\\Utility\\SortArray::sortByWeightElement');
  return $operations;
}