Allow extension icon styles to reference assets

Example usage:

"icon": {
    "backgroundImage": "url('{$assets}/icon.svg')"
}
This commit is contained in:
Toby Zerner 2015-10-02 17:55:42 +09:30
parent ef2cc9b0cd
commit b4cb5a11da

View File

@ -44,6 +44,10 @@ class ExtensionManager
if (file_exists($manifest = $extensionsDir . '/' . $dir . '/composer.json')) {
$extensions[$dir] = json_decode(file_get_contents($manifest), true);
foreach ($extensions[$dir]['extra']['flarum-extension']['icon'] as &$style) {
$style = str_replace('{$assets}', Core::url().'/extensions/'.$dir.'/assets', $style);
}
foreach ($installed as $package) {
if ($package['name'] === $extensions[$dir]['name']) {
$extensions[$dir]['version'] = $package['version'];