// Add namespaced paths for modules and themes.
$namespaces =
[];
foreach ($module_handler->
getModuleList() as $name =>
$extension) { $namespaces[$name] =
$extension->
getPath();
} foreach ($theme_handler->
listInfo() as $name =>
$extension) { $namespaces[$name] =
$extension->
getPath();
} foreach ($namespaces as $name =>
$path) { $this->
addPath($path . '/templates',
$name);
// Allow accessing the root of an extension by using the namespace without
// using directory traversal from the `/templates` directory.
$this->
addPath($path,
$name);
} if (!
empty($twig_config['allowed_file_extensions'
])) { // Provide a safe fallback for sites that have not updated their
// services.yml file or rebuilt the container, as well as for child
// classes.
$this->allowedFileExtensions =
$twig_config['allowed_file_extensions'
];
} }