You are here

public function SmsMessageDirection::render in SMS Framework 8

Same name and namespace in other branches
  1. 2.x src/Plugin/views/field/SmsMessageDirection.php \Drupal\sms\Plugin\views\field\SmsMessageDirection::render()
  2. 2.1.x src/Plugin/views/field/SmsMessageDirection.php \Drupal\sms\Plugin\views\field\SmsMessageDirection::render()

Renders the field.

Parameters

\Drupal\views\ResultRow $values: The values retrieved from a single row of a view's query result.

Return value

string|\Drupal\Component\Render\MarkupInterface The rendered output. If the output is safe it will be wrapped in an object that implements MarkupInterface. If it is empty or unsafe it will be a string.

Overrides FieldPluginBase::render

File

src/Plugin/views/field/SmsMessageDirection.php, line 19

Class

SmsMessageDirection
Field handler to show SMS message direction.

Namespace

Drupal\sms\Plugin\views\field

Code

public function render(ResultRow $values) {
  switch ($this
    ->getValue($values)) {
    case Direction::INCOMING:
      return $this
        ->t('Incoming');
    case Direction::OUTGOING:
      return $this
        ->t('Outgoing');
    default:
      return $this
        ->t('Unknown direction');
  }
}