function menu_token_prepare_context_replacement in Menu Token 8
Same name and namespace in other branches
- 9.1.x menu_token.module \menu_token_prepare_context_replacement()
Parameters
$links:
File
- ./
menu_token.module, line 401 - Contains menu_token.module.
Code
function menu_token_prepare_context_replacement(&$links) {
$token_service = \Drupal::token();
$bubbleable_metadata = new BubbleableMetadata();
foreach ($links as $key => $linkData) {
try {
$links[$key]["link"]["url"] = $token_service
->replace($linkData["link"]["url"], [], [
"configuration" => $linkData["config"],
], $bubbleable_metadata);
$links[$key]["link"]["title"] = $token_service
->replace($linkData["link"]["title"], [], [
"configuration" => $linkData["config"],
], $bubbleable_metadata);
$links[$key]["link"]["options"]["bubleble_metadata"] = $bubbleable_metadata;
} catch (Exception $exception) {
}
$links[$key] = $links[$key]["link"];
}
}