function _views_update_8002_token_update
Updates a views configuration string from using %/! to twig tokens.
Parameters
string $text: Text in which to search for argument tokens and replace them with their twig representation.
array $argument_map: A map of argument machine names keyed by their previous index.
Return value
string The updated token.
1 call to _views_update_8002_token_update()
- views_update_8002 in core/
modules/ views/ views.install - Updates %1 and !1 tokens to argument tokens.
File
-
core/
modules/ views/ views.install, line 269
Code
function _views_update_8002_token_update($text, array $argument_map) {
$text = preg_replace_callback('/%(\\d)/', function ($match) use ($argument_map) {
return "{{ arguments.{$argument_map[$match[1]]} }}";
}, $text);
$text = preg_replace_callback('/!(\\d)/', function ($match) use ($argument_map) {
return "{{ raw_arguments.{$argument_map[$match[1]]} }}";
}, $text);
return $text;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.