From 4885736b0eccf8f4b6843e8892ba7d389480e749 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 16 Feb 2017 17:51:54 +1300 Subject: [PATCH] API Upgrade CMS to use new Config API --- _config/routes.yml | 4 +--- code/Controllers/CMSMain.php | 2 +- code/Controllers/CMSPageEditController.php | 1 - code/Model/SiteTree.php | 2 +- code/Model/VirtualPage.php | 7 +++++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/_config/routes.yml b/_config/routes.yml index 8e0b8ae2..cb757986 100644 --- a/_config/routes.yml +++ b/_config/routes.yml @@ -1,7 +1,6 @@ --- Name: modelascontrollerroutes -Before: '*' -After: '#rootroutes' +After: '*' --- SilverStripe\Control\Director: rules: @@ -11,7 +10,6 @@ SilverStripe\Control\Director: '$URLSegment//$Action/$ID/$OtherID': 'SilverStripe\CMS\Controllers\ModelAsController' --- Name: legacycmsroutes -After: '#adminroutes' --- SilverStripe\Control\Director: rules: diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php index fd8427eb..d128a31d 100644 --- a/code/Controllers/CMSMain.php +++ b/code/Controllers/CMSMain.php @@ -952,7 +952,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $gridFieldConfig = GridFieldConfig::create()->addComponents( new GridFieldSortableHeader(), new GridFieldDataColumns(), - new GridFieldPaginator(self::config()->page_length) + new GridFieldPaginator($this->config()->get('page_length')) ); if ($parentID) { $linkSpec = $this->Link(); diff --git a/code/Controllers/CMSPageEditController.php b/code/Controllers/CMSPageEditController.php index 5074a4ad..a0d4cdd8 100644 --- a/code/Controllers/CMSPageEditController.php +++ b/code/Controllers/CMSPageEditController.php @@ -8,7 +8,6 @@ use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Control\Controller; use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPResponse; -use SilverStripe\Core\Convert; use SilverStripe\Forms\Form; use SilverStripe\ORM\FieldType\DBHTMLText; diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index 03164f61..314ac110 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -1573,7 +1573,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi )); } - $charset = ContentNegotiator::config()->get('encoding'); + $charset = ContentNegotiator::config()->uninherited('encoding'); $tags[] = FormField::create_tag('meta', array( 'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=' . $charset, diff --git a/code/Model/VirtualPage.php b/code/Model/VirtualPage.php index fbbd27d3..54668552 100644 --- a/code/Model/VirtualPage.php +++ b/code/Model/VirtualPage.php @@ -102,7 +102,10 @@ class VirtualPage extends Page */ public function getNonVirtualisedFields() { - return array_merge($this->config()->non_virtual_fields, $this->config()->initially_copied_fields); + return array_merge( + VirtualPage::config()->non_virtual_fields, + VirtualPage::config()->initially_copied_fields + ); } public function setCopyContentFromID($val) @@ -417,7 +420,7 @@ class VirtualPage extends Page * Pass unrecognized method calls on to the original data object * * @param string $method - * @param string $args + * @param array $args * @return mixed */ public function __call($method, $args)