You are here

public function DisplayPluginBase::getArgumentsTokens in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::getArgumentsTokens()

Returns to tokens for arguments.

This function is similar to views_handler_field::getRenderTokens() but without fields tokens.

Overrides DisplayPluginInterface::getArgumentsTokens

1 call to DisplayPluginBase::getArgumentsTokens()
DisplayPluginBase::renderMoreLink in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
Renders the 'more' link.

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 1047
Contains \Drupal\views\Plugin\views\display\DisplayPluginBase.

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

public function getArgumentsTokens() {
  $tokens = array();
  if (!empty($this->view->build_info['substitutions'])) {
    $tokens = $this->view->build_info['substitutions'];
  }

  // Add tokens for every argument (contextual filter) and path arg.
  $handlers = count($this->view->display_handler
    ->getHandlers('argument'));
  for ($count = 1; $count <= $handlers; $count++) {
    if (!isset($tokens["%{$count}"])) {
      $tokens["%{$count}"] = '';
    }

    // Use strip tags as there should never be HTML in the path.
    // However, we need to preserve special characters like " that
    // were encoded by \Drupal\Component\Utility\Html::escape().
    $tokens["!{$count}"] = isset($this->view->args[$count - 1]) ? strip_tags(Html::decodeEntities($this->view->args[$count - 1])) : '';
  }
  return $tokens;
}