public function Serialized::render in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/field/Serialized.php \Drupal\views\Plugin\views\field\Serialized::render()
- 9 core/modules/views/src/Plugin/views/field/Serialized.php \Drupal\views\Plugin\views\field\Serialized::render()
File
- core/
modules/ views/ src/ Plugin/ views/ field/ Serialized.php, line 69
Class
- Serialized
- Field handler to show data of serialized fields.
Namespace
Drupal\views\Plugin\views\fieldCode
public function render(ResultRow $values) {
$value = $values->{$this->field_alias};
if ($this->options['format'] == 'unserialized') {
return $this
->sanitizeValue(print_r(unserialize($value), TRUE));
}
elseif ($this->options['format'] == 'key' && !empty($this->options['key'])) {
$value = (array) unserialize($value);
return $this
->sanitizeValue($value[$this->options['key']]);
}
return $value;
}