function EscaperExtension::setDefaultStrategy
Sets the default strategy to use when not defined by the user.
The strategy can be a valid PHP callback that takes the template name as an argument and returns the strategy to use.
Parameters
string|false|callable(string $templateName): string $defaultStrategy An escaping strategy:
1 call to EscaperExtension::setDefaultStrategy()
- EscaperExtension::__construct in vendor/
twig/ twig/ src/ Extension/ EscaperExtension.php
File
-
vendor/
twig/ twig/ src/ Extension/ EscaperExtension.php, line 92
Class
Namespace
Twig\ExtensionCode
public function setDefaultStrategy($defaultStrategy) : void {
if ('name' === $defaultStrategy) {
$defaultStrategy = [
FileExtensionEscapingStrategy::class,
'guess',
];
}
$this->defaultStrategy = $defaultStrategy;
}