Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Deprecate API being removed in CMS 6 #3060

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions code/Controllers/CMSMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -1029,9 +1029,14 @@ public function getSearchContext()
* Returns the search form schema for the current model
*
* @return string
* @deprecated 5.4.0 Will be replaced with SilverStripe\ORM\Search\SearchContextForm::getSchemaData()
*/
public function getSearchFieldSchema()
{
Deprecation::noticeWithNoReplacment(
'5.4.0',
'Will be replaced with SilverStripe\ORM\Search\SearchContextForm::getSchemaData()'
);
$schemaUrl = $this->Link('schema/SearchForm');

$context = $this->getSearchContext();
Expand Down Expand Up @@ -1771,9 +1776,11 @@ public function childfilter(HTTPRequest $request): HTTPResponse
* @param array $params Query parameters to use, or null if none present
* @return CMSSiteTreeFilter The filter class
* @throws InvalidArgumentException if invalid filter class is passed.
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected function getQueryFilter($params)
{
Deprecation::noticeWithNoReplacment('5.4.0');
if (empty($params['FilterClass'])) {
return null;
}
Expand All @@ -1793,9 +1800,11 @@ protected function getQueryFilter($params)
* @param int $parentID Optional parent node to filter on (can't be combined with other search criteria)
* @return SS_List
* @throws InvalidArgumentException if invalid filter class is passed.
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
public function getList($params = [], $parentID = 0)
{
Deprecation::noticeWithNoReplacment('5.4.0');
if ($filter = $this->getQueryFilter($params)) {
return $filter->getFilteredPages();
} else {
Expand Down
30 changes: 26 additions & 4 deletions code/Controllers/CMSSiteTreeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ abstract class CMSSiteTreeFilter implements LeftAndMain_SearchFilter
* Caution: Unescaped data.
*
* @var array
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $params = [];

/**
* List of filtered items and all their parents
*
* @var array
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $_cache_ids = null;

Expand All @@ -50,21 +52,25 @@ abstract class CMSSiteTreeFilter implements LeftAndMain_SearchFilter
* others in the complete set.
*
* @var array
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $_cache_highlight_ids = null;

/**
* @var array
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $_cache_expanded = [];

/**
* @var string
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $childrenMethod = null;

/**
* @var string
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $numChildrenMethod = 'numChildren';

Expand Down Expand Up @@ -104,22 +110,30 @@ public function __construct($params = null)
}
}

/**
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
public function getChildrenMethod()
{
Deprecation::noticeWithNoReplacment('5.4.0');
return $this->childrenMethod;
}

/**
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
public function getNumChildrenMethod()
{
Deprecation::noticeWithNoReplacment('5.4.0');
return $this->numChildrenMethod;
}

/**
* @deprecated 5.4.0 Will be renamed to getRecordClasses()
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it
*/
public function getPageClasses($page)
{
Deprecation::noticeWithNoReplacment('5.4.0', 'Will be renamed to getRecordClasses()');
Deprecation::noticeWithNoReplacment('5.4.0');
if ($this->_cache_ids === null) {
$this->populateIDs();
}
Expand All @@ -142,18 +156,22 @@ abstract public function getFilteredPages();

/**
* @return array Map of Page IDs to their respective ParentID values.
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it
*/
public function pagesIncluded()
{
Deprecation::noticeWithNoReplacment('5.4.0');
return $this->mapIDs($this->getFilteredPages());
}

/**
* Populate the IDs of the pages returned by pagesIncluded(), also including
* the necessary parent helper pages.
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it
*/
protected function populateIDs()
{
Deprecation::noticeWithNoReplacment('5.4.0');
$parents = [];
$this->_cache_ids = [];
$this->_cache_highlight_ids = [];
Expand Down Expand Up @@ -184,11 +202,11 @@ protected function populateIDs()
}

/**
* @deprecated 5.4.0 Will be renamed to isRecordIncluded()
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it
*/
public function isPageIncluded($page)
{
Deprecation::noticeWithNoReplacment('5.4.0', 'Will be renamed to isRecordIncluded()');
Deprecation::noticeWithNoReplacment('5.4.0');
if ($this->_cache_ids === null) {
$this->populateIDs();
}
Expand All @@ -201,9 +219,11 @@ public function isPageIncluded($page)
*
* @param DataList $query Unfiltered query
* @return DataList Filtered query
* @deprecated 5.4.0 Will be replaced with a SearchContext subclass
*/
protected function applyDefaultFilters($query)
{
Deprecation::noticeWithNoReplacment('5.4.0', 'Will be replaced with a SearchContext subclass');
$sng = SiteTree::singleton();
foreach ($this->params as $name => $val) {
if (empty($val)) {
Expand Down Expand Up @@ -259,9 +279,11 @@ protected function applyDefaultFilters($query)
*
* @param SS_List $pages
* @return array
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it
*/
protected function mapIDs($pages)
{
Deprecation::noticeWithNoReplacment('5.4.0');
$ids = [];
if ($pages) {
foreach ($pages as $page) {
Expand Down
2 changes: 2 additions & 0 deletions code/Controllers/CMSSiteTreeFilter_DeletedPages.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ class CMSSiteTreeFilter_DeletedPages extends CMSSiteTreeFilter

/**
* @var string
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $childrenMethod = "AllHistoricalChildren";

/**
* @var string
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $numChildrenMethod = 'numHistoricalChildren';

Expand Down
2 changes: 2 additions & 0 deletions code/Controllers/CMSSiteTreeFilter_PublishedPages.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ public static function title()

/**
* @var string
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $childrenMethod = "AllHistoricalChildren";

/**
* @var string
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $numChildrenMethod = 'numHistoricalChildren';

Expand Down
2 changes: 2 additions & 0 deletions code/Controllers/CMSSiteTreeFilter_StatusDeletedPages.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ class CMSSiteTreeFilter_StatusDeletedPages extends CMSSiteTreeFilter

/**
* @var string
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $childrenMethod = "AllHistoricalChildren";

/**
* @var string
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
*/
protected $numChildrenMethod = 'numHistoricalChildren';

Expand Down