function views_plugin_style::tokenize_value

Same name in other branches
  1. 7.x-3.x plugins/views_plugin_style.inc \views_plugin_style::tokenize_value()

Take a value and apply token replacement logic to it.

2 calls to views_plugin_style::tokenize_value()
views_plugin_style::get_row_class in plugins/views_plugin_style.inc
Return the token replaced row class for the specified row.
views_plugin_style_rss::get_description in plugins/views_plugin_style_rss.inc
Get RSS feed description.

File

plugins/views_plugin_style.inc, line 129

Class

views_plugin_style
Base class to define a style plugin handler.

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;
}