7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Tip: Use SiteConfig to enable DOM in Assets
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 676 Views |
-
Tip: Use SiteConfig to enable DOM in Assets

21 December 2010 at 3:08am Last edited: 21 December 2010 3:08am
Hi,
with DOM enabled users can not drag and drop files to other folders in "Files & Images".
There is a setting to disable DOM for the assets folder: DataObjectManager::allow_assets_overrideSince one of our customers wants dom enabled most the time, but sometimes needs to move files we added a config option for him:
Create a file named "CustomAssetAdmin.php":<?php
class CustomAssetAdmin extends DataObjectDecorator {
function init() {
$config = SiteConfig::current_site_config();
DataObjectManager::allow_assets_override($config->DomAllowAssetsOverride);
}
}
?>Add the option to your siteconfig: "CustomSiteConfig.php":
<?php
class CustomSiteConfig extends DataObjectDecorator {function extraStatics() {
return array(
'db' => array(
'DomAllowAssetsOverride' => 'boolean'
)
);
}public function updateCMSFields(FieldSet &$fields) {
$fields->addFieldToTab('Root.Settings', new CheckBoxField('DomAllowAssetsOverride','DOM in "Dateien und Bilder" verwenden?')); }
}
?>Add these to your _config.php
DataObject::add_extension('SiteConfig', 'CustomSiteConfig');
Object::add_extension('AssetAdmin', 'CustomAssetAdmin');That gives your users the option to enable/disable DOM for the assets folder on demand.
Johannes
| 676 Views | ||
|
Page:
1
|
Go to Top |

