1.20.x views_plugin_style.inc views_plugin_style::tokenize_value($value, $row_index)

Take a value and apply token replacement logic to it.

File

modules/views/plugins/views_plugin_style.inc, line 148
Definition of views_plugin_style.

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