mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUG Fixing misspelled variable not being able to select subsite for Folder
This commit is contained in:
parent
bf1390f0f8
commit
0968eac399
@ -30,13 +30,13 @@ class FileSubsites extends DataExtension {
|
||||
function updateCMSFields(FieldList $fields) {
|
||||
if($this->owner instanceof Folder) {
|
||||
$sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin');
|
||||
$dropdownValues = array();
|
||||
$dropdownValues[0] = 'All sites';
|
||||
$values = array();
|
||||
$values[0] = 'All sites';
|
||||
foreach ($sites as $site) {
|
||||
$dropDownValues[$site->ID] = $site->Title;
|
||||
$values[$site->ID] = $site->Title;
|
||||
}
|
||||
ksort($dropdownValues);
|
||||
if($sites)$fields->push(new DropdownField("SubsiteID", "Subsite", $dropdownValues));
|
||||
ksort($values);
|
||||
if($sites)$fields->push(new DropdownField('SubsiteID', 'Subsite', $values));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,21 @@ class FileSubsitesTest extends BaseSubsiteTest {
|
||||
$file->onAfterUpload();
|
||||
$this->assertEquals($folder->SubsiteID, $file->SubsiteID);
|
||||
}
|
||||
|
||||
|
||||
function testSubsitesFolderDropdown() {
|
||||
$this->objFromFixture('Member', 'admin')->logIn();
|
||||
|
||||
$file = new Folder();
|
||||
|
||||
$this->assertEquals(array(
|
||||
'Main site',
|
||||
'Template',
|
||||
'Subsite1 Template',
|
||||
'Subsite2 Template',
|
||||
'Test 1',
|
||||
'Test 2',
|
||||
'Test 3'
|
||||
), $file->getCMSFields()->dataFieldByName('SubsiteID')->getSource());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user