-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
silverstripe/framework
5.2.22
goldfinch/enchantment
1.0.20
silverstripe/admin
2.2.13
In a minimal Silverstripe project (see versions above) which does not use following packages, you'll see several errors emitted from EnchantmentAssetsExtension
. Other projects will/won't use an entirely different set of packages:
silverstripe-versioned-admin
silverstripe/cms
silverstripe/session-manager
This happens because there are no guards wrapped around every call to Requirements::block()
.
Solutions:
1). Wrap all such code-blocks with:
if (
InstalledVersions::isInstalled(
'silverstripe/cms',
)
) {
Requirements::block(
'silverstripe/cms: client/dist/styles/bundle.css',
);
}
- Or remove all such code-blocks and allow userland config to control using config system instead, ala:
Goldfinch\Enchantment\Extensions\EnchantmentAssetsExtension:
block_packages:
- 'silverstripe-versioned-admin'
- 'silverstripe/cms'
- 'silverstripe/session-manager'
foreach ($this->config()->get('block_packages') as $packageName) {
if (InstalledVersions::isInstalled($packageName)) {
Requirements::block(sprintf('%s:client/dist/styles/bundle.css', $packageName));
Requirements::block(sprintf('%s:client/dist/css/GroupedCmsMenu.css', $packageName));
}
}
Metadata
Metadata
Assignees
Labels
No labels