diff --git a/src/library/Box/TwigLoader.php b/src/library/Box/TwigLoader.php index 0067271f3..d74dd1a7a 100644 --- a/src/library/Box/TwigLoader.php +++ b/src/library/Box/TwigLoader.php @@ -1,4 +1,5 @@ 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"]; + 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)) { + 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))); diff --git a/src/modules/Extension/Service.php b/src/modules/Extension/Service.php index a0d9399aa..807604b70 100644 --- a/src/modules/Extension/Service.php +++ b/src/modules/Extension/Service.php @@ -209,6 +209,16 @@ class Service implements InjectionAwareInterface $result[$key]['icon_url'] = $iconPath; } + foreach ($result as $key => $value) { + $icon_url = $this->di['array_get']($value, 'icon_url'); + if ($icon_url) { + $iconPath = realpath(PATH_MODS . DIRECTORY_SEPARATOR . ucfirst($value['id']) . DIRECTORY_SEPARATOR . basename($icon_url)); + if (file_exists($iconPath)) { + $result[$key]['icon_path'] = 'mod_' . ucfirst($value['id']) . '_' . basename($icon_url); + } + } + } + return $result; } @@ -436,7 +446,7 @@ class Service implements InjectionAwareInterface $extracted = PATH_CACHE . '/' . md5(uniqid()); $zip = PATH_CACHE . '/' . md5(uniqid()) . '.zip'; - + // Create a temporary directory to extract the extension mkdir($extracted, 0755, true); diff --git a/src/modules/Extension/html_admin/mod_extension_index.html.twig b/src/modules/Extension/html_admin/mod_extension_index.html.twig index 86d5f387e..c3650700b 100644 --- a/src/modules/Extension/html_admin/mod_extension_index.html.twig +++ b/src/modules/Extension/html_admin/mod_extension_index.html.twig @@ -47,9 +47,9 @@