You are here

protected function SendStatus::getMessage in Simplenews 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/views/field/SendStatus.php \Drupal\simplenews\Plugin\views\field\SendStatus::getMessage()
  2. 3.x src/Plugin/views/field/SendStatus.php \Drupal\simplenews\Plugin\views\field\SendStatus::getMessage()

Return a compiled message to display.

Parameters

\Drupal\node\Entity\Node $node: The node object.

Return value

array An array containing the elements of the message to be rendered.

1 call to SendStatus::getMessage()
SendStatus::render in src/Plugin/views/field/SendStatus.php
Renders the field.

File

src/Plugin/views/field/SendStatus.php, line 55

Class

SendStatus
Field handler to provide send status of a newsletter issue.

Namespace

Drupal\simplenews\Plugin\views\field

Code

protected function getMessage(Node $node) {
  $status = $node->simplenews_issue->status;
  $message = \Drupal::service('simplenews.spool_storage')
    ->issueSummary($node);
  $images = [
    SIMPLENEWS_STATUS_SEND_PENDING => 'images/sn-cron.png',
    SIMPLENEWS_STATUS_SEND_READY => 'images/sn-sent.png',
  ];
  if (isset($images[$status])) {
    $message['uri'] = drupal_get_path('module', 'simplenews') . '/' . $images[$status];
  }
  else {
    $message['uri'] = NULL;
  }
  return $message;
}