You are here

protected function SendStatus::getMessage in Simplenews 8

Same name and namespace in other branches
  1. 8.2 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

$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 52

Class

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

Namespace

Drupal\simplenews\Plugin\views\field

Code

protected function getMessage($node) {
  $status = $node->simplenews_issue->status;
  $message = \Drupal::service('simplenews.spool_storage')
    ->issueSummary($node);
  $images = array(
    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;
}