function DisplayPluginBase::recursiveReplaceTokens

Replace the query parameters recursively, both key and value.

Parameters

array $parts: Query parts of the request.

array $tokens: Tokens for replacement.

Return value

array The parameters with replacements done.

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 2182

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

protected function recursiveReplaceTokens(array $parts, array $tokens) : array {
    foreach ($parts as $key => $value) {
        if (is_array($value)) {
            $value = $this->recursiveReplaceTokens($value, $tokens);
        }
        else {
            $value = $this->viewsTokenReplace($value, $tokens);
        }
        if (!is_int($key)) {
            unset($parts[$key]);
            $key = $this->viewsTokenReplace($key, $tokens);
        }
        $parts[$key] = $value;
    }
    return $parts;
}

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