options = $options; $paths_arr = array($options['mods'], $options['theme']); $this->setPaths($paths_arr); } protected function findTemplate($name, $throw = true) { // normalize name $name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')); if (isset($this->cache[$name])) { return $this->cache[$name]; } $name_split = explode("_", $name); $paths = array(); $paths[] = $this->options["theme"] . DIRECTORY_SEPARATOR . "html"; if (isset($name_split[1])) { $paths[] = $this->options["mods"] . DIRECTORY_SEPARATOR . ucfirst($name_split[1]) . DIRECTORY_SEPARATOR . "html_" . $this->options["type"]; } foreach ($paths as $path) { if (file_exists($path . DIRECTORY_SEPARATOR . $name)) { return $this->cache[$name] = $path . '/' . $name; } if (str_ends_with($name, 'icon.svg') && file_exists(dirname($path) . DIRECTORY_SEPARATOR . 'icon.svg')) { return $this->cache[$name] = dirname($path) . DIRECTORY_SEPARATOR . 'icon.svg'; } } throw new \Twig\Error\LoaderError(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $paths))); } }