public function HandlerBase::sanitizeValue in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::sanitizeValue()
Sanitize the value for output.
Parameters
$value: The value being rendered.
$type: The type of sanitization needed. If not provided, \Drupal\Component\Utility\Html::escape() is used.
Return value
\Drupal\views\Render\ViewsRenderPipelineMarkup Returns the safe value.
Overrides ViewsHandlerInterface::sanitizeValue
17 calls to HandlerBase::sanitizeValue()
- DblogMessage::render in core/
modules/ dblog/ src/ Plugin/ views/ field/ DblogMessage.php - Renders the field.
- DblogOperations::render in core/
modules/ dblog/ src/ Plugin/ views/ field/ DblogOperations.php - Renders the field.
- EntityLabel::render in core/
modules/ views/ src/ Plugin/ views/ field/ EntityLabel.php - Renders the field.
- FieldPluginBase::render in core/
modules/ views/ src/ Plugin/ views/ field/ FieldPluginBase.php - Renders the field.
- FieldTest::render in core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ field/ FieldTest.php - Renders the field.
File
- core/
modules/ views/ src/ Plugin/ views/ HandlerBase.php, line 195
Class
- HandlerBase
- Base class for Views handler plugins.
Namespace
Drupal\views\Plugin\viewsCode
public function sanitizeValue($value, $type = NULL) {
switch ($type) {
case 'xss':
$value = Xss::filter($value);
break;
case 'xss_admin':
$value = Xss::filterAdmin($value);
break;
case 'url':
$value = Html::escape(UrlHelper::stripDangerousProtocols($value));
break;
default:
$value = Html::escape($value);
break;
}
return ViewsRenderPipelineMarkup::create($value);
}