$replacements +=
array_fill_keys($tokens, ''
);
} } // Each token value is markup if it implements MarkupInterface otherwise it
// is plain text. Convert them, but only if needed. It can cause corruption
// to render a string that's already plain text or to escape a string
// that's already markup.
foreach ($replacements as $token =>
$value) { if ($markup) { // Escape plain text tokens.
$replacements[$token] =
$value instanceof MarkupInterface ?
$value :
new HtmlEscapedText($value);
} else { // Render markup tokens to plain text.
$replacements[$token] =
$value instanceof MarkupInterface ? PlainTextOutput::
renderFromHtml($value) :
$value;
} } // Optionally alter the list of replacement values.
if (!
empty($options['callback'
])) { $function =
$options['callback'
];
$function($replacements,
$data,
$options,
$bubbleable_metadata);
}