You are here

public function ScheduleController::view in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Controller/ScheduleController.php \Drupal\business_rules\Controller\ScheduleController::view()

View schedule canonical.

Return value

array The render array.

1 call to ScheduleController::view()
ScheduleController::revisionShow in src/Controller/ScheduleController.php
Displays a Schedule revision.
1 string reference to 'ScheduleController::view'
business_rules.routing.yml in ./business_rules.routing.yml
business_rules.routing.yml

File

src/Controller/ScheduleController.php, line 57

Class

ScheduleController
Class ScheduleController.

Namespace

Drupal\business_rules\Controller

Code

public function view($business_rules_schedule) {
  $schedule = Schedule::load($business_rules_schedule);
  $output['#title'] = $schedule
    ->label();
  $output['name'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Name'),
    '#markup' => $schedule
      ->getName(),
  ];
  $output['status'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Executed'),
    '#markup' => $schedule
      ->isExecuted() ? $this
      ->t('Yes') : $this
      ->t('No'),
  ];
  $output['created'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Created'),
    '#markup' => $this->dateFormatter
      ->format($schedule
      ->getCreatedTime(), 'medium'),
  ];
  $output['changed'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Changed'),
    '#markup' => $this->dateFormatter
      ->format($schedule
      ->getChangedTime(), 'medium'),
  ];
  $output['scheduled'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Scheduled'),
    '#markup' => $this->dateFormatter
      ->format($schedule
      ->getScheduled(), 'medium'),
  ];
  $output['triggered_by'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Triggered by'),
    '#markup' => $schedule
      ->getTriggeredBy()
      ->toLink(NULL, 'edit-form')
      ->toString(),
  ];
  return $output;
}