You are here

protected function MessageListForm::getOperations in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/Form/MessageListForm.php \Drupal\rng\Form\MessageListForm::getOperations()
  2. 3.x src/Form/MessageListForm.php \Drupal\rng\Form\MessageListForm::getOperations()

Gets operations for a rule.

Parameters

\Drupal\rng\RuleInterface $rule: The rule.

Return value

array An array of links suitable for an 'operations' element.

1 call to MessageListForm::getOperations()
MessageListForm::buildForm in src/Form/MessageListForm.php
Form constructor.

File

src/Form/MessageListForm.php, line 253

Class

MessageListForm
Creates message list form.

Namespace

Drupal\rng\Form

Code

protected function getOperations(RuleInterface $rule) {
  $links = [];
  $destination = $this->redirectDestination
    ->getAsArray();
  if ($component = $this
    ->getDateCondition($rule)) {
    if ($component
      ->access('edit')) {
      $links['edit-date'] = [
        'title' => $this
          ->t('Edit date'),
        'url' => $component
          ->urlInfo('edit-form'),
        'query' => $destination,
      ];
    }
  }
  if ($rule
    ->access('delete')) {
    $links['delete'] = [
      'title' => $this
        ->t('Delete'),
      'url' => $rule
        ->urlInfo('delete-form'),
      'query' => $destination,
    ];
  }
  return $links;
}