From 4f15894f86afbd40601b2ef4e439a6a132fe22fc Mon Sep 17 00:00:00 2001 From: Raissa North Date: Wed, 31 Jan 2018 10:08:07 +1300 Subject: [PATCH 1/9] Add codesniffer ruleset --- .travis.yml | 2 +- phpcs.xml.dist | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 phpcs.xml.dist diff --git a/.travis.yml b/.travis.yml index b5dc03e4..3324659a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,7 @@ before_script: script: - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi - - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=vendor/silverstripe/framework/phpcs.xml.dist src tests *.php --ignore=host-map.php; fi + - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src tests *.php --ignore=host-map.php; fi - if [[ $BEHAT_TEST ]]; then vendor/bin/behat @subsites; fi after_success: diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 00000000..b8f7d59d --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,11 @@ + + + CodeSniffer ruleset for SilverStripe coding conventions. + + + + + + + + From aa370f8df69b15414cd18324421321816db5760d Mon Sep 17 00:00:00 2001 From: Raissa North Date: Wed, 31 Jan 2018 10:10:09 +1300 Subject: [PATCH 2/9] FIX Replace deprecated doPublish() method with publishRecursive() --- tests/php/SiteTreeSubsitesTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/php/SiteTreeSubsitesTest.php b/tests/php/SiteTreeSubsitesTest.php index 8a5ff392..3ffbc8a3 100644 --- a/tests/php/SiteTreeSubsitesTest.php +++ b/tests/php/SiteTreeSubsitesTest.php @@ -315,7 +315,7 @@ public function testValidateURLSegment() $subsite1NewPage->URLSegment = 'important-page'; // Also exists in main subsite $subsite1NewPage->write(); $this->assertEquals('important-page', $subsite1NewPage->URLSegment); - $subsite1NewPage->doPublish(); + $subsite1NewPage->publishRecursive(); $subsite1NewPageLive = Versioned::get_one_by_stage( 'Page', 'Live', @@ -330,7 +330,7 @@ public function testValidateURLSegment() $subsite1NewPage2->URLSegment = 'important-page'; // Also exists in main subsite $subsite1NewPage2->write(); $this->assertEquals('important-page-2', $subsite1NewPage2->URLSegment); - $subsite1NewPage2->doPublish(); + $subsite1NewPage2->publishRecursive(); $subsite1NewPage2Live = Versioned::get_one_by_stage( 'Page', 'Live', From db69c486a0251bb6a7e1d8006988216d7ae1f4d3 Mon Sep 17 00:00:00 2001 From: Raissa North Date: Wed, 31 Jan 2018 17:25:32 +1300 Subject: [PATCH 3/9] FIX: Turn SilverStripe Map into an array to give an accurate falsey value --- src/Extensions/SiteTreeSubsites.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Extensions/SiteTreeSubsites.php b/src/Extensions/SiteTreeSubsites.php index 5ac586aa..d69383b8 100644 --- a/src/Extensions/SiteTreeSubsites.php +++ b/src/Extensions/SiteTreeSubsites.php @@ -105,7 +105,7 @@ public function updateCMSFields(FieldList $fields) $subsitesMap = []; if ($subsites && $subsites->count()) { $subsitesToMap = $subsites->exclude('ID', $this->owner->SubsiteID); - $subsitesMap = $subsitesToMap->map('ID', 'Title'); + $subsitesMap = $subsitesToMap->map('ID', 'Title')->toArray(); } // Master page edit field (only allowed from default subsite to avoid inconsistent relationships) From 8b5f593999645780d8fe667cb41910dc74b61008 Mon Sep 17 00:00:00 2001 From: Raissa North Date: Thu, 1 Feb 2018 13:19:02 +1300 Subject: [PATCH 4/9] Fix line length --- src/Extensions/GroupSubsites.php | 8 ++++++-- src/Extensions/SiteTreeSubsites.php | 10 ++++++++-- src/Model/Subsite.php | 18 ++++++++++++------ src/Pages/SubsitesVirtualPage.php | 15 ++++++++++++--- tests/php/SubsiteAdminTest.php | 3 ++- tests/php/SubsiteTest.php | 6 ++++-- 6 files changed, 44 insertions(+), 16 deletions(-) diff --git a/src/Extensions/GroupSubsites.php b/src/Extensions/GroupSubsites.php index 0e4921e4..2d138b41 100644 --- a/src/Extensions/GroupSubsites.php +++ b/src/Extensions/GroupSubsites.php @@ -187,7 +187,8 @@ public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null) } } - // WORKAROUND for databases that complain about an ORDER BY when the column wasn't selected (e.g. SQL Server) + // WORKAROUND for databases that complain about an ORDER BY when the column wasn't selected + // (e.g. SQL Server) $select = $query->getSelect(); if (isset($select[0]) && !$select[0] == 'COUNT(*)') { $query->addOrderBy('AccessAllSubsites', 'DESC'); @@ -230,7 +231,10 @@ public function providePermissions() return [ 'SECURITY_SUBSITE_GROUP' => [ 'name' => _t(__CLASS__ . '.MANAGE_SUBSITES', 'Manage subsites for groups'), - 'category' => _t('SilverStripe\\Security\\Permission.PERMISSIONS_CATEGORY', 'Roles and access permissions'), + 'category' => _t( + 'SilverStripe\\Security\\Permission.PERMISSIONS_CATEGORY', + 'Roles and access permissions' + ), 'help' => _t( __CLASS__ . '.MANAGE_SUBSITES_HELP', 'Ability to limit the permissions for a group to one or more subsites.' diff --git a/src/Extensions/SiteTreeSubsites.php b/src/Extensions/SiteTreeSubsites.php index d69383b8..689197d3 100644 --- a/src/Extensions/SiteTreeSubsites.php +++ b/src/Extensions/SiteTreeSubsites.php @@ -62,7 +62,10 @@ public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null) } // If you're querying by ID, ignore the sub-site - this is a bit ugly... - // if(!$query->where || (strpos($query->where[0], ".\"ID\" = ") === false && strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false && strpos($query->where[0], "ID = ") !== 0)) { + // if(!$query->where + // || (strpos($query->where[0], ".\"ID\" = ") === false + // && strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false + // && strpos($query->where[0], "ID = ") !== 0)) { if ($query->filtersOnID()) { return; } @@ -418,7 +421,10 @@ public function augmentSyncLinkTracking() Subsite::disable_subsite_filter(true); $candidatePage = DataObject::get_one( SiteTree::class, - "\"URLSegment\" = '" . Convert::raw2sql(urldecode($rest)) . "' AND \"SubsiteID\" = " . $subsiteID, + "\"URLSegment\" = '" + . Convert::raw2sql(urldecode($rest)) + . "' AND \"SubsiteID\" = " + . $subsiteID, false ); Subsite::disable_subsite_filter($origDisableSubsiteFilter); diff --git a/src/Model/Subsite.php b/src/Model/Subsite.php index 529fb75f..4b25af23 100644 --- a/src/Model/Subsite.php +++ b/src/Model/Subsite.php @@ -480,7 +480,9 @@ public static function accessible_sites( ) ->innerJoin( 'Permission', - "\"Group\".\"ID\"=\"Permission\".\"GroupID\" AND \"Permission\".\"Code\" IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')" + "\"Group\".\"ID\"=\"Permission\".\"GroupID\" + AND \"Permission\".\"Code\" + IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')" ); if (!$subsites) { @@ -504,7 +506,9 @@ public static function accessible_sites( ->innerJoin('PermissionRole', '"Group_Roles"."PermissionRoleID"="PermissionRole"."ID"') ->innerJoin( 'PermissionRoleCode', - "\"PermissionRole\".\"ID\"=\"PermissionRoleCode\".\"RoleID\" AND \"PermissionRoleCode\".\"Code\" IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')" + "\"PermissionRole\".\"ID\"=\"PermissionRoleCode\".\"RoleID\" + AND \"PermissionRoleCode\".\"Code\" + IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')" ); if (!$subsites && $rolesSubsites) { @@ -628,10 +632,12 @@ public static function hasMainSitePermission($member = null, $permissionCodes = $groupCount = DB::query(" SELECT COUNT(\"Permission\".\"ID\") FROM \"Permission\" - INNER JOIN \"Group\" ON \"Group\".\"ID\" = \"Permission\".\"GroupID\" AND \"Group\".\"AccessAllSubsites\" = 1 - INNER JOIN \"Group_Members\" ON \"Group_Members\".\"GroupID\" = \"Permission\".\"GroupID\" - WHERE \"Permission\".\"Code\" IN ('$SQL_perms') - AND \"Group_Members\".\"MemberID\" = {$memberID} + INNER JOIN \"Group\" + ON \"Group\".\"ID\" = \"Permission\".\"GroupID\" AND \"Group\".\"AccessAllSubsites\" = 1 + INNER JOIN \"Group_Members\" + ON \"Group_Members\".\"GroupID\" = \"Permission\".\"GroupID\" + WHERE \"Permission\".\"Code\" + IN ('$SQL_perms') AND \"Group_Members\".\"MemberID\" = {$memberID} ")->value(); // Count this user's groups which have a role that can access the main site diff --git a/src/Pages/SubsitesVirtualPage.php b/src/Pages/SubsitesVirtualPage.php index ea2a882f..b4c3d4f6 100644 --- a/src/Pages/SubsitesVirtualPage.php +++ b/src/Pages/SubsitesVirtualPage.php @@ -141,9 +141,18 @@ public function fieldLabels($includerelations = true) { $labels = parent::fieldLabels($includerelations); $labels['CustomMetaTitle'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomMetaTitle', 'Title'); - $labels['CustomMetaKeywords'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomMetaKeywords', 'Keywords'); - $labels['CustomMetaDescription'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomMetaDescription', 'Description'); - $labels['CustomExtraMeta'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomExtraMeta', 'Custom Meta Tags'); + $labels['CustomMetaKeywords'] = _t( + 'SilverStripe\\Subsites\\Model\\Subsite.CustomMetaKeywords', + 'Keywords' + ); + $labels['CustomMetaDescription'] = _t( + 'SilverStripe\\Subsites\\Model\\Subsite.CustomMetaDescription', + 'Description' + ); + $labels['CustomExtraMeta'] = _t( + 'SilverStripe\\Subsites\\Model\\Subsite.CustomExtraMeta', + 'Custom Meta Tags' + ); return $labels; } diff --git a/tests/php/SubsiteAdminTest.php b/tests/php/SubsiteAdminTest.php index 5bdb2656..f5815f9e 100644 --- a/tests/php/SubsiteAdminTest.php +++ b/tests/php/SubsiteAdminTest.php @@ -39,7 +39,8 @@ public function testBasicView() // Confirm that this URL gets you the entire page, with the edit form loaded $response2 = Director::test( - "admin/subsites/SilverStripe-Subsites-Model-Subsite/EditForm/field/SilverStripe-Subsites-Model-Subsite/item/$subsite1ID/edit", + "admin/subsites/SilverStripe-Subsites-Model-Subsite/EditForm/field/" + ."SilverStripe-Subsites-Model-Subsite/item/$subsite1ID/edit", null, $this->adminLoggedInSession() ); diff --git a/tests/php/SubsiteTest.php b/tests/php/SubsiteTest.php index 7c23fc89..bea04263 100644 --- a/tests/php/SubsiteTest.php +++ b/tests/php/SubsiteTest.php @@ -57,7 +57,8 @@ public function testSubsiteCreation() $tmplStaff = $this->objFromFixture('Page', 'staff'); $tmplHome = DataObject::get_one('Page', "\"URLSegment\" = 'home'"); - // Publish all the pages in the template, testing that DataObject::get only returns pages from the chosen subsite + // Publish all the pages in the template, testing that DataObject::get only returns pages + // from the chosen subsite $pages = DataObject::get(SiteTree::class); $totalPages = $pages->count(); foreach ($pages as $page) { @@ -193,7 +194,8 @@ public function testStrictSubdomainMatching() $this->assertEquals( $subsite1->ID, Subsite::getSubsiteIDForDomain('www.example.org'), - 'Matches without strict checking when using www prefix, still matching first domain regardless of www prefix (falling back to subsite primary key ordering)' + 'Matches without strict checking when using www prefix, ' + .'still matching first domain regardless of www prefix (falling back to subsite primary key ordering)' ); $this->assertEquals( $subsite1->ID, From 098660e27d611164f77bdf9915b22d2b7ee69f42 Mon Sep 17 00:00:00 2001 From: Raissa North Date: Thu, 1 Feb 2018 13:22:48 +1300 Subject: [PATCH 5/9] Refactor GridFieldSubsiteDetailForm_ItemRequest and $_cache_accessible_sites Remove underscores to comply with PSR-2 --- src/Forms/GridFieldSubsiteDetailForm.php | 2 +- ...GridFieldSubsiteDetailFormItemRequest.php} | 2 +- src/Model/Subsite.php | 20 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) rename src/Forms/{GridFieldSubsiteDetailForm_ItemRequest.php => GridFieldSubsiteDetailFormItemRequest.php} (95%) diff --git a/src/Forms/GridFieldSubsiteDetailForm.php b/src/Forms/GridFieldSubsiteDetailForm.php index 739fd618..35efc4ee 100644 --- a/src/Forms/GridFieldSubsiteDetailForm.php +++ b/src/Forms/GridFieldSubsiteDetailForm.php @@ -6,5 +6,5 @@ class GridFieldSubsiteDetailForm extends GridFieldDetailForm { - protected $itemRequestClass = GridFieldSubsiteDetailForm_ItemRequest::class; + protected $itemRequestClass = GridFieldSubsiteDetailFormItemRequest::class; } diff --git a/src/Forms/GridFieldSubsiteDetailForm_ItemRequest.php b/src/Forms/GridFieldSubsiteDetailFormItemRequest.php similarity index 95% rename from src/Forms/GridFieldSubsiteDetailForm_ItemRequest.php rename to src/Forms/GridFieldSubsiteDetailFormItemRequest.php index c93a8866..275368d2 100644 --- a/src/Forms/GridFieldSubsiteDetailForm_ItemRequest.php +++ b/src/Forms/GridFieldSubsiteDetailFormItemRequest.php @@ -7,7 +7,7 @@ use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest; use SilverStripe\Subsites\Model\Subsite; -class GridFieldSubsiteDetailForm_ItemRequest extends GridFieldDetailForm_ItemRequest +class GridFieldSubsiteDetailFormItemRequest extends GridFieldDetailForm_ItemRequest { private static $allowed_actions = [ diff --git a/src/Model/Subsite.php b/src/Model/Subsite.php index 4b25af23..4b78ed31 100644 --- a/src/Model/Subsite.php +++ b/src/Model/Subsite.php @@ -74,14 +74,14 @@ class Subsite extends DataObject * * @array */ - private static $_cache_accessible_sites = []; + protected static $cache_accessible_sites = []; /** * Memory cache of subsite id for domains * * @var array */ - private static $_cache_subsite_for_domain = []; + protected static $cache_subsite_for_domain = []; /** * Numeric array of all themes which are allowed to be selected for all subsites. @@ -268,8 +268,8 @@ public static function getSubsiteIDForDomain($host = null, $checkPermissions = t $currentUserId = Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0; $cacheKey = implode('_', [$host, $currentUserId, static::config()->get('check_is_public')]); - if (isset(self::$_cache_subsite_for_domain[$cacheKey])) { - return self::$_cache_subsite_for_domain[$cacheKey]; + if (isset(self::$cache_subsite_for_domain[$cacheKey])) { + return self::$cache_subsite_for_domain[$cacheKey]; } $SQL_host = Convert::raw2sql($host); @@ -319,7 +319,7 @@ public static function getSubsiteIDForDomain($host = null, $checkPermissions = t } if ($cacheKey) { - self::$_cache_subsite_for_domain[$cacheKey] = $subsiteID; + self::$cache_subsite_for_domain[$cacheKey] = $subsiteID; } return $subsiteID; @@ -355,8 +355,8 @@ public static function disable_subsite_filter($disabled = true) */ public static function on_db_reset() { - self::$_cache_accessible_sites = []; - self::$_cache_subsite_for_domain = []; + self::$cache_accessible_sites = []; + self::$cache_subsite_for_domain = []; } /** @@ -462,8 +462,8 @@ public static function accessible_sites( // Cache handling $cacheKey = $SQL_codes . '-' . $member->ID . '-' . $includeMainSite . '-' . $mainSiteTitle; - if (isset(self::$_cache_accessible_sites[$cacheKey])) { - return self::$_cache_accessible_sites[$cacheKey]; + if (isset(self::$cache_accessible_sites[$cacheKey])) { + return self::$cache_accessible_sites[$cacheKey]; } /** @skipUpgrade */ @@ -539,7 +539,7 @@ public static function accessible_sites( } } - self::$_cache_accessible_sites[$cacheKey] = $subsites; + self::$cache_accessible_sites[$cacheKey] = $subsites; return $subsites; } From 809b1d9b859f10db2a5b8200117345c14e0caf1b Mon Sep 17 00:00:00 2001 From: Raissa North Date: Thu, 1 Feb 2018 13:24:48 +1300 Subject: [PATCH 6/9] Fix switch statement syntax and replace deprecated doPublish() method. --- src/Model/SubsiteDomain.php | 9 +++------ tests/php/SiteTreeSubsitesTest.php | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Model/SubsiteDomain.php b/src/Model/SubsiteDomain.php index 660da6f2..faf6d952 100644 --- a/src/Model/SubsiteDomain.php +++ b/src/Model/SubsiteDomain.php @@ -166,15 +166,12 @@ public function Link() public function getFullProtocol() { switch ($this->Protocol) { - case self::PROTOCOL_HTTPS: { + case self::PROTOCOL_HTTPS: return 'https://'; - } - case self::PROTOCOL_HTTP: { + case self::PROTOCOL_HTTP: return 'http://'; - } - default: { + default: return Director::protocol(); - } } } diff --git a/tests/php/SiteTreeSubsitesTest.php b/tests/php/SiteTreeSubsitesTest.php index 3ffbc8a3..926571e4 100644 --- a/tests/php/SiteTreeSubsitesTest.php +++ b/tests/php/SiteTreeSubsitesTest.php @@ -288,7 +288,7 @@ public function testValidateURLSegment() $mainHome->Content = '

Some new content

'; $mainHome->write(); $this->assertEquals('home', $mainHome->URLSegment); - $mainHome->doPublish(); + $mainHome->publishRecursive(); $mainHomeLive = Versioned::get_one_by_stage('Page', 'Live', sprintf('"SiteTree"."ID" = \'%d\'', $mainHome->ID)); $this->assertEquals('home', $mainHomeLive->URLSegment); @@ -298,7 +298,7 @@ public function testValidateURLSegment() $subsite1Home->Content = '

In subsite 1

'; $subsite1Home->write(); $this->assertEquals('home', $subsite1Home->URLSegment); - $subsite1Home->doPublish(); + $subsite1Home->publishRecursive(); $subsite1HomeLive = Versioned::get_one_by_stage( 'Page', 'Live', From e405dff9467612e5d07827ca5408a21dccd0cf82 Mon Sep 17 00:00:00 2001 From: Raissa North Date: Thu, 1 Feb 2018 14:24:04 +1300 Subject: [PATCH 7/9] FIX Add an empty string to the subsite operations dropdown. This prevents a subsite from being chosen as the default option, assuming this is undesired --- src/Extensions/SiteTreeSubsites.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Extensions/SiteTreeSubsites.php b/src/Extensions/SiteTreeSubsites.php index 689197d3..de7b60e6 100644 --- a/src/Extensions/SiteTreeSubsites.php +++ b/src/Extensions/SiteTreeSubsites.php @@ -124,7 +124,8 @@ public function updateCMSFields(FieldList $fields) DropdownField::create('CopyToSubsiteID', _t( __CLASS__ . '.CopyToSubsite', 'Copy page to subsite' - ), $subsitesMap), + ), $subsitesMap) + ->setEmptyString('Select an Option'), CheckboxField::create( 'CopyToSubsiteWithChildren', _t(__CLASS__ . '.CopyToSubsiteWithChildren', 'Include children pages?') From 5404dafac13f989301254e1935a382c7160e951f Mon Sep 17 00:00:00 2001 From: Raissa North Date: Thu, 1 Feb 2018 14:26:12 +1300 Subject: [PATCH 8/9] FIX Fix unit tests for installations in which the base url is set --- tests/php/SiteTreeSubsitesTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/php/SiteTreeSubsitesTest.php b/tests/php/SiteTreeSubsitesTest.php index 926571e4..bd3dc7cc 100644 --- a/tests/php/SiteTreeSubsitesTest.php +++ b/tests/php/SiteTreeSubsitesTest.php @@ -430,6 +430,9 @@ public function provideAlternateAbsoluteLink() */ public function testAlternateAbsoluteLink($pageFixtureName, $action, $expectedAbsoluteLink) { + // Setting a control value, in case base url is set for the installation under test + Config::modify()->set(Director::class, 'alternate_base_url', 'http://localhost/'); + /** @var Page $page */ $page = $this->objFromFixture(Page::class, $pageFixtureName); From 34c0c4946cbbe17b291472c66cf018af8276b23c Mon Sep 17 00:00:00 2001 From: Raissa North Date: Thu, 1 Feb 2018 15:41:54 +1300 Subject: [PATCH 9/9] FIX Hide subsite operations when no subsites exist --- src/Extensions/SiteTreeSubsites.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Extensions/SiteTreeSubsites.php b/src/Extensions/SiteTreeSubsites.php index de7b60e6..4285a451 100644 --- a/src/Extensions/SiteTreeSubsites.php +++ b/src/Extensions/SiteTreeSubsites.php @@ -108,13 +108,13 @@ public function updateCMSFields(FieldList $fields) $subsitesMap = []; if ($subsites && $subsites->count()) { $subsitesToMap = $subsites->exclude('ID', $this->owner->SubsiteID); - $subsitesMap = $subsitesToMap->map('ID', 'Title')->toArray(); + $subsitesMap = $subsitesToMap->map('ID', 'Title'); } // Master page edit field (only allowed from default subsite to avoid inconsistent relationships) $isDefaultSubsite = $this->owner->SubsiteID == 0 || $this->owner->Subsite()->DefaultSite; - if ($isDefaultSubsite && $subsitesMap) { + if ($isDefaultSubsite && $subsitesMap->count()) { $fields->addFieldToTab( 'Root.Main', ToggleCompositeField::create( @@ -124,8 +124,7 @@ public function updateCMSFields(FieldList $fields) DropdownField::create('CopyToSubsiteID', _t( __CLASS__ . '.CopyToSubsite', 'Copy page to subsite' - ), $subsitesMap) - ->setEmptyString('Select an Option'), + ), $subsitesMap), CheckboxField::create( 'CopyToSubsiteWithChildren', _t(__CLASS__ . '.CopyToSubsiteWithChildren', 'Include children pages?')