Skip to content

Commit 3533171

Browse files
committed
[ticket/17279] Get iconify icons from assets folder
PHPBB3-17279
1 parent 37a92df commit 3533171

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

Diff for: assets/iconify_bundler.php

+17-5
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
class iconify_bundler
2020
{
21-
/** @var log_interface */
22-
protected $log;
21+
/** @var string Icons path */
22+
protected string $icons_path;
2323

2424
/** @var string[] Icons list */
2525
protected $icons_list = [];
@@ -28,10 +28,11 @@ class iconify_bundler
2828
* Constructor for iconify bundler
2929
*
3030
* @param log_interface|null $log Logger
31+
* @param string $root_path phpBB root path
3132
*/
32-
public function __construct(?log_interface $log)
33+
public function __construct(protected ?log_interface $log, string $root_path)
3334
{
34-
$this->log = $log;
35+
$this->icons_path = $root_path . 'assets/iconify/';
3536
}
3637

3738
/**
@@ -206,6 +207,17 @@ protected function name_to_icon(string $icon_name): ?array
206207
return null;
207208
}
208209

210+
/**
211+
* Get collection path for prefix
212+
*
213+
* @param string $prefix Icon collection prefix
214+
* @return string Icon collection path
215+
*/
216+
protected function get_collection_path(string $prefix): string
217+
{
218+
return $this->icons_path . $prefix . '.json';
219+
}
220+
209221
/**
210222
* Load icons date for supplied icons array
211223
*
@@ -220,7 +232,7 @@ protected function load_icons_data(array $icons): string
220232
{
221233
// Load icon set
222234
$collection = new Collection($prefix);
223-
$collection_file = Collection::findIconifyCollection($prefix);
235+
$collection_file = $this->get_collection_path($prefix);
224236
if (!file_exists($collection_file) || !$collection->loadFromFile($collection_file))
225237
{
226238
$this->log?->add('critical', ANONYMOUS, '', 'LOG_ICON_COLLECTION_INVALID', false, [$prefix]);

0 commit comments

Comments
 (0)