MINOR Check for existing subsites in dropdown generation of FileSubsites->updateCMSFields() (from r85443)

This commit is contained in:
Tom Rix 2010-03-01 03:00:34 +00:00
parent b696fb8e03
commit 8378f60285

View File

@ -36,7 +36,7 @@ class FileSubsites extends DataObjectDecorator {
function updateCMSFields(FieldSet &$fields) { function updateCMSFields(FieldSet &$fields) {
if($this->owner instanceof Folder) { if($this->owner instanceof Folder) {
$sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin'); $sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin');
$dropdownValues = $sites->toDropdownMap(); $dropdownValues = ($sites) ? $sites->toDropdownMap() : array();
$dropdownValues[0] = 'All sites'; $dropdownValues[0] = 'All sites';
ksort($dropdownValues); ksort($dropdownValues);
if($sites)$fields->addFieldToTab('Root.Details', new DropdownField("SubsiteID", "Subsite", $dropdownValues)); if($sites)$fields->addFieldToTab('Root.Details', new DropdownField("SubsiteID", "Subsite", $dropdownValues));