function StylePluginBase::tokenizeValue

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::tokenizeValue()
  2. 10 core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::tokenizeValue()
  3. 11.x core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::tokenizeValue()

Take a value and apply token replacement logic to it.

3 calls to StylePluginBase::tokenizeValue()
Grid::getCustomClass in core/modules/views/src/Plugin/views/style/Grid.php
Return the token-replaced row or column classes for the specified result.
Rss::getDescription in core/modules/views/src/Plugin/views/style/Rss.php
Get RSS feed description.
StylePluginBase::getRowClass in core/modules/views/src/Plugin/views/style/StylePluginBase.php
Return the token replaced row class for the specified row.

File

core/modules/views/src/Plugin/views/style/StylePluginBase.php, line 230

Class

StylePluginBase
Base class for views style plugins.

Namespace

Drupal\views\Plugin\views\style

Code

public function tokenizeValue($value, $row_index) {
    if (strpos($value, '{{') !== FALSE) {
        // Row tokens might be empty, for example for node row style.
        $tokens = isset($this->rowTokens[$row_index]) ? $this->rowTokens[$row_index] : [];
        if (!empty($this->view->build_info['substitutions'])) {
            $tokens += $this->view->build_info['substitutions'];
        }
        $value = $this->viewsTokenReplace($value, $tokens);
    }
    else {
        // ::viewsTokenReplace() will run Xss::filterAdmin on the
        // resulting string. We do the same here for consistency.
        $value = Xss::filterAdmin($value);
    }
    return $value;
}

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