mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Merge pull request #353 from creative-commoners/pulls/2.0/count-properly
FIX be consistent with the variable setting
This commit is contained in:
commit
418fa586a3
@ -15,9 +15,11 @@ use SilverStripe\Forms\FieldList;
|
|||||||
use SilverStripe\Forms\FormAction;
|
use SilverStripe\Forms\FormAction;
|
||||||
use SilverStripe\Forms\ToggleCompositeField;
|
use SilverStripe\Forms\ToggleCompositeField;
|
||||||
use SilverStripe\i18n\i18n;
|
use SilverStripe\i18n\i18n;
|
||||||
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\DataExtension;
|
use SilverStripe\ORM\DataExtension;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\DataQuery;
|
use SilverStripe\ORM\DataQuery;
|
||||||
|
use SilverStripe\ORM\Map;
|
||||||
use SilverStripe\ORM\Queries\SQLSelect;
|
use SilverStripe\ORM\Queries\SQLSelect;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\Security\Security;
|
use SilverStripe\Security\Security;
|
||||||
@ -106,10 +108,11 @@ class SiteTreeSubsites extends DataExtension
|
|||||||
public function updateCMSFields(FieldList $fields)
|
public function updateCMSFields(FieldList $fields)
|
||||||
{
|
{
|
||||||
$subsites = Subsite::accessible_sites('CMS_ACCESS_CMSMain');
|
$subsites = Subsite::accessible_sites('CMS_ACCESS_CMSMain');
|
||||||
$subsitesMap = [];
|
|
||||||
if ($subsites && $subsites->count()) {
|
if ($subsites && $subsites->count()) {
|
||||||
$subsitesToMap = $subsites->exclude('ID', $this->owner->SubsiteID);
|
$subsitesToMap = $subsites->exclude('ID', $this->owner->SubsiteID);
|
||||||
$subsitesMap = $subsitesToMap->map('ID', 'Title');
|
$subsitesMap = $subsitesToMap->map('ID', 'Title');
|
||||||
|
} else {
|
||||||
|
$subsitesMap = new Map(ArrayList::create());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Master page edit field (only allowed from default subsite to avoid inconsistent relationships)
|
// Master page edit field (only allowed from default subsite to avoid inconsistent relationships)
|
||||||
|
Loading…
Reference in New Issue
Block a user