You are here

function Serialized::render in Views (for Drupal 7) 8.3

Render the field.

Parameters

$values: The values retrieved from the database.

Overrides FieldPluginBase::render

File

lib/Drupal/views/Plugin/views/field/Serialized.php, line 64
Definition of Drupal\views\Plugin\views\field\Serialized.

Class

Serialized
Field handler to show data of serialized fields.

Namespace

Drupal\views\Plugin\views\field

Code

function render($values) {
  $value = $values->{$this->field_alias};
  if ($this->options['format'] == 'unserialized') {
    return check_plain(print_r(unserialize($value), TRUE));
  }
  elseif ($this->options['format'] == 'key' && !empty($this->options['key'])) {
    $value = (array) unserialize($value);
    return check_plain($value[$this->options['key']]);
  }
  return $value;
}