function HandlerBase::sanitizeValue

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::sanitizeValue()
  2. 8.9.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::sanitizeValue()
  3. 11.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::sanitizeValue()

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
FieldPluginBase::render in core/modules/views/src/Plugin/views/field/FieldPluginBase.php
FieldTest::render in core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldTest.php

... See full list

File

core/modules/views/src/Plugin/views/HandlerBase.php, line 203

Class

HandlerBase
Base class for Views handler plugins.

Namespace

Drupal\views\Plugin\views

Code

public function sanitizeValue($value, $type = NULL) {
    if ($value === NULL) {
        return '';
    }
    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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.