function StylePluginBase::tokenize_value

Take a value and apply token replacement logic to it.

2 calls to StylePluginBase::tokenize_value()
Rss::get_description in drupal/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php
Get RSS feed description.
StylePluginBase::get_row_class in drupal/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php
Return the token replaced row class for the specified row.

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php, line 195
Definition of Drupal\views\Plugin\views\style\StylePluginBase.

Class

StylePluginBase
Base class to define a style plugin handler.

Namespace

Drupal\views\Plugin\views\style

Code

function tokenize_value($value, $row_index) {
  if (strpos($value, '[') !== FALSE || strpos($value, '!') !== FALSE || strpos($value, '%') !== FALSE) {
    $fake_item = array(
      'alter_text' => TRUE,
      'text' => $value,
    );

    // Row tokens might be empty, for example for node row style.
    $tokens = isset($this->row_tokens[$row_index]) ? $this->row_tokens[$row_index] : array();
    if (!empty($this->view->build_info['substitutions'])) {
      $tokens += $this->view->build_info['substitutions'];
    }
    if ($tokens) {
      $value = strtr($value, $tokens);
    }
  }
  return $value;
}