diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php index a63fcdd807..18cb08e00f 100644 --- a/code/Controllers/CMSMain.php +++ b/code/Controllers/CMSMain.php @@ -86,7 +86,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr /** * Unique ID for page icons CSS block */ - const PAGE_ICONS_ID = 'PageIcons'; + public const CMS_RECORD_ICONS_ID = 'PageIcons'; + + /** + * Unique ID for page icons CSS block + * @deprecated 5.4.0 use CMS_RECORD_ICONS_ID instead + */ + const PAGE_ICONS_ID = CMSMain::CMS_RECORD_ICONS_ID; private static $url_segment = 'pages'; @@ -139,6 +145,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr 'schema', 'SearchForm', 'SiteTreeAsUL', + 'TreeAsUL', 'getshowdeletedsubtree', 'savetreenode', 'getsubtree', @@ -158,14 +165,17 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr 'TreeIsFiltered' => 'Boolean', 'AddForm' => 'HTMLFragment', 'LinkPages' => 'Text', + 'LinkRecords' => 'Text', 'Link' => 'Text', 'ListViewForm' => 'HTMLFragment', 'ExtraTreeTools' => 'HTMLFragment', 'PageList' => 'HTMLFragment', 'PageListSidebar' => 'HTMLFragment', 'SiteTreeHints' => 'HTMLFragment', + 'TreeHints' => 'HTMLFragment', 'SecurityID' => 'Text', 'SiteTreeAsUL' => 'HTMLFragment', + 'TreeAsUL' => 'HTMLFragment', ]; private static $dependencies = [ @@ -197,7 +207,7 @@ public function index(HTTPRequest $request): HTTPResponse // In case we're not showing a specific record, explicitly remove any session state, // to avoid it being highlighted in the tree, and causing an edit form to show. if (!$request->param('Action')) { - $this->setCurrentPageID(null); + $this->setCurrentRecordID(null); } return parent::index($request); @@ -219,9 +229,11 @@ public function getResponseNegotiator(): PjaxResponseNegotiator * Get pages listing area * * @return DBHTMLText + * @deprecated 5.4.0 Will be renamed to RecordList */ public function PageList() { + Deprecation::noticeWithNoReplacment('5.4.0', 'Will be renamed to RecordList'); return $this->renderWith($this->getTemplatesWithSuffix('_PageList')); } @@ -229,9 +241,11 @@ public function PageList() * Page list view for edit-form * * @return DBHTMLText + * @deprecated 5.4.0 Will be removed without equivalent functionality */ public function PageListSidebar() { + Deprecation::noticeWithNoReplacment('5.4.0'); return $this->renderWith($this->getTemplatesWithSuffix('_PageList_Sidebar')); } @@ -256,7 +270,7 @@ public function ShowSwitchView() public function SwitchView($page = null) { if (!$page) { - $page = $this->currentPage(); + $page = $this->currentRecord(); } if ($page) { @@ -289,14 +303,32 @@ public function Link($action = null) return $link; } + /** + * @deprecated 5.4.0 Use LinkRecords instead + */ public function LinkPages() + { + Deprecation::notice('5.4.0', 'Use LinkRecords() instead.'); + return $this->LinkRecords(); + } + + public function LinkRecords() { return CMSPagesController::singleton()->Link(); } + /** + * @deprecated 5.4.0 Use LinkRecordsWithSearch instead + */ public function LinkPagesWithSearch() { - return $this->LinkWithSearch($this->LinkPages()); + Deprecation::notice('5.4.0', 'Use LinkRecordsWithSearch() instead.'); + return $this->LinkRecordsWithSearch(); + } + + public function LinkRecordsWithSearch() + { + return $this->LinkWithSearch($this->LinkRecords()); } /** @@ -375,19 +407,37 @@ public function getCMSEditLinkForManagedDataObject(SiteTree $obj): string return Controller::join_links(CMSPageEditController::singleton()->Link('show'), $obj->ID); } + /** + * @deprecated 5.4.0 Use LinkRecordEdit() instead. + */ public function LinkPageEdit($id = null) + { + Deprecation::notice('5.4.0', 'Use LinkRecordEdit() instead.'); + return $this->LinkRecordEdit($id); + } + + public function LinkRecordEdit($id = null) { if (!$id) { - $id = $this->currentPageID(); + $id = $this->currentRecordID(); } return $this->LinkWithSearch( Controller::join_links(CMSPageEditController::singleton()->Link('show'), $id) ); } + /** + * @deprecated 5.4.0 Use LinkRecordSettings() instead. + */ public function LinkPageSettings() { - if ($id = $this->currentPageID()) { + Deprecation::notice('5.4.0', 'Use LinkRecordSettings() instead.'); + return $this->LinkRecordSettings(); + } + + public function LinkRecordSettings() + { + if ($id = $this->currentRecordID()) { return $this->LinkWithSearch( Controller::join_links(CMSPageSettingsController::singleton()->Link('show'), $id) ); @@ -396,10 +446,19 @@ public function LinkPageSettings() } } + /** + * @deprecated 5.4.0 Use LinkRecordHistory() instead. + */ public function LinkPageHistory() + { + Deprecation::notice('5.4.0', 'Use LinkRecordHistory() instead.'); + return $this->LinkRecordHistory(); + } + + public function LinkRecordHistory() { $controller = Injector::inst()->get(CMSPageHistoryViewerController::class); - if (($id = $this->currentPageID()) && $controller) { + if (($id = $this->currentRecordID()) && $controller) { if ($controller) { return $this->LinkWithSearch( Controller::join_links($controller->Link('show'), $id) @@ -463,7 +522,16 @@ public function LinkWithSearch($link) return $link; } + /** + * @deprecated 5.4.0 Use LinkRecordAdd() instead. + */ public function LinkPageAdd($extra = null, $placeholders = null) + { + Deprecation::notice('5.4.0', 'Use LinkRecordAdd() instead.'); + return $this->LinkRecordAdd($extra, $placeholders); + } + + public function LinkRecordAdd($extra = null, $placeholders = null) { $link = CMSPageAddController::singleton()->Link(); $this->extend('updateLinkPageAdd', $link); @@ -481,10 +549,12 @@ public function LinkPageAdd($extra = null, $placeholders = null) /** * @return string + * @deprecated 5.4.0 Use SilverStripe\CMS\Model\SiteTree::CMSEditLink() instead. */ public function LinkPreview() { - $record = $this->getRecord($this->currentPageID()); + Deprecation::notice('5.4.0', 'Use ' . SiteTree::class . '::CMSEditLink() instead.'); + $record = $this->getRecord($this->currentRecordID()); $baseLink = Director::absoluteBaseURL(); if ($record && $record instanceof SiteTree) { // if we are an external redirector don't show a link @@ -499,8 +569,18 @@ public function LinkPreview() /** * Return the entire site tree as a nested set of ULs + * @deprecated 5.4.0 Use TreeAsUL() instead. */ public function SiteTreeAsUL() + { + Deprecation::notice('5.4.0', 'Use TreeAsUL() instead.'); + return $this->TreeAsUL(); + } + + /** + * Return the entire tree as a nested set of ULs + */ + public function TreeAsUL() { $treeClass = $this->config()->get('model_class'); $filter = $this->getSearchFilter(); @@ -510,7 +590,7 @@ public function SiteTreeAsUL() 'numChildrenMethod' => $filter ? $filter->getNumChildrenMethod() : 'numChildren', ]); - $html = $this->getSiteTreeFor($treeClass); + $html = $this->getTreeFor($treeClass); $this->extend('updateSiteTreeAsUL', $html); @@ -529,6 +609,7 @@ public function SiteTreeAsUL() * @param callable $filterFunction * @param int $nodeCountThreshold * @return string Nested unordered list with links to each page + * @deprecated 5.4.0 Use getTreeFor() instead. */ public function getSiteTreeFor( $className, @@ -537,6 +618,38 @@ public function getSiteTreeFor( $numChildrenMethod = null, $filterFunction = null, $nodeCountThreshold = null + ) { + Deprecation::notice('5.4.0', 'Use getTreeFor() instead.'); + return $this->getTreeFor( + $className, + $rootID, + $childrenMethod, + $numChildrenMethod, + $filterFunction, + $nodeCountThreshold + ); + } + + /** + * Get a tree HTML listing which displays the nodes under the given criteria. + * + * @param string $className The class of the root object + * @param string $rootID The ID of the root object. If this is null then a complete tree will be + * shown + * @param string $childrenMethod The method to call to get the children of the tree. For example, + * Children, AllChildrenIncludingDeleted, or AllHistoricalChildren + * @param string $numChildrenMethod + * @param callable $filterFunction + * @param int $nodeCountThreshold + * @return string Nested unordered list with links to each record + */ + public function getTreeFor( + $className, + $rootID = null, + $childrenMethod = null, + $numChildrenMethod = null, + $filterFunction = null, + $nodeCountThreshold = null ) { $nodeCountThreshold = is_null($nodeCountThreshold) ? Config::inst()->get($className, 'node_threshold_total') : $nodeCountThreshold; // Provide better defaults from filter @@ -569,7 +682,7 @@ public function getSiteTreeFor( $markingSet->markPartialTree(); // Ensure current page is exposed - $currentPage = $this->currentPage(); + $currentPage = $this->currentRecord(); if ($currentPage) { $markingSet->markToExpose($currentPage); } @@ -654,7 +767,7 @@ public function getTreeNodeClasses(SiteTree $node) */ public function getsubtree(HTTPRequest $request): HTTPResponse { - $html = $this->getSiteTreeFor( + $html = $this->getTreeFor( $this->config()->get('model_class'), $request->getVar('ID'), null, @@ -750,7 +863,7 @@ public function savetreenode(HTTPRequest $request): HTTPResponse if (!SecurityToken::inst()->checkRequest($request)) { $this->httpError(400); } - if (!$this->CanOrganiseSitetree()) { + if (!$this->canOrganiseTree()) { $this->httpError( 403, _t( @@ -859,12 +972,21 @@ public function savetreenode(HTTPRequest $request): HTTPResponse /** * Whether the current member has the permission to reorganise SiteTree objects. * @return bool + * @deprecated 5.4.0 Use canOrganiseTree instead. */ public function CanOrganiseSitetree() { - return Permission::check('SITETREE_REORGANISE'); + Deprecation::notice('5.4.0', 'Use canOrganiseTree instead.'); + return $this->canOrganiseTree(); } + /** + * Whether the current member has the permission to reorganise SiteTree objects. + */ + public function canOrganiseTree(): bool + { + return Permission::check('SITETREE_REORGANISE'); + } /** * @return boolean @@ -887,9 +1009,11 @@ public function ExtraTreeTools() * and can be modified on extensions through updateSearchContext * * @return \SilverStripe\ORM\Search\SearchContext + * @deprecated 5.4.0 Will be replaced with SilverStripe\CMS\Model\SiteTree::getDefaultSearchContext(). */ public function getSearchContext() { + Deprecation::notice('5.4.0', 'Will be replaced with ' . SiteTree::class . '::getDefaultSearchContext().'); $context = SiteTree::singleton()->getDefaultSearchContext(); $this->extend('updateSearchContext', $context); @@ -959,7 +1083,7 @@ public function getSearchForm() $pageClasses = DropdownField::create( 'Search__ClassName', _t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGETYPEOPT', 'Page type', 'Dropdown for limiting search to a page type'), - $this->getPageTypes() + $this->getRecordTypes() ); $pageClasses->setEmptyString(_t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGETYPEANYOPT', 'Any')); @@ -1003,15 +1127,25 @@ public function getSearchForm() * Returns a sorted array suitable for a dropdown with pagetypes and their translated name * * @return array + * @deprecated 5.4.0 Use getRecordTypes() instead. */ protected function getPageTypes() { - $pageTypes = []; - foreach (SiteTree::page_type_classes() as $pageTypeClass) { - $pageTypes[$pageTypeClass] = SiteTree::singleton($pageTypeClass)->i18n_singular_name(); + Deprecation::notice('5.4.0', 'Use getRecordTypes() instead.'); + return $this->getRecordTypes(); + } + + /** + * Returns a sorted array suitable for a dropdown with record types and their translated name + */ + protected function getRecordTypes(): array + { + $types = []; + foreach (SiteTree::page_type_classes() as $class) { + $types[$class] = SiteTree::singleton($class)->i18n_singular_name(); } - asort($pageTypes); - return $pageTypes; + asort($types); + return $types; } public function doSearch(array $data, Form $form): HTTPResponse @@ -1040,7 +1174,7 @@ public function Breadcrumbs($unlinked = false) { $items = ArrayList::create(); - if (($this->getAction() !== 'index') && ($record = $this->currentPage())) { + if (($this->getAction() !== 'index') && ($record = $this->currentRecord())) { // The page is being edited $this->buildEditFormBreadcrumb($items, $record, $unlinked); } else { @@ -1134,8 +1268,21 @@ private function buildListViewBreadcrumb(ArrayList $items, SiteTree $page): void * 'data-hints' attribute of root node of jsTree. * * @return string Serialized JSON + * @deprecated 5.4.0 Use TreeHints() instead. */ public function SiteTreeHints() + { + Deprecation::notice('5.4.0', 'Use TreeHints() instead.'); + return $this->TreeHints(); + } + + /** + * Create serialized JSON string with site tree hints data to be injected into + * 'data-hints' attribute of root node of jsTree. + * + * @return string Serialized JSON + */ + public function TreeHints(): string { $classes = SiteTree::page_type_classes(); $memberID = Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0; @@ -1207,8 +1354,19 @@ public function SiteTreeHints() * which allows the user to change the page type. * * @return SS_List + * @deprecated 5.4.0 use RecordTypes() instead. */ public function PageTypes() + { + Deprecation::notice('5.4.0', 'Use RecordTypes() instead.'); + return $this->RecordTypes(); + } + + /** + * Populates an array of classes in the CMS + * which allows the user to change the record's ClassName field. + */ + public function RecordTypes(): SS_List { $classes = SiteTree::page_type_classes(); @@ -1312,7 +1470,7 @@ public function EditForm($request = null) $this->httpError(400); return null; } - $this->setCurrentPageID($id); + $this->setCurrentRecordID($id); } return $this->getEditForm(); } @@ -1326,7 +1484,7 @@ public function getEditForm($id = null, $fields = null) { // Get record if (!$id) { - $id = $this->currentPageID(); + $id = $this->currentRecordID(); } $record = $this->getRecord($id); @@ -1553,7 +1711,7 @@ public function ViewState($default = 'treeview') /** * Callback to request the list of page types allowed under a given page instance. - * Provides a slower but more precise response over SiteTreeHints + * Provides a slower but more precise response over TreeHints */ public function childfilter(HTTPRequest $request): HTTPResponse { @@ -1650,7 +1808,7 @@ public function ListViewForm() ->setLinkSpec($linkSpec) ->setAttributes(['data-pjax-target' => 'ListViewForm,Breadcrumbs']) ); - $this->setCurrentPageID($parentID); + $this->setCurrentRecordID($parentID); } $gridField = GridField::create('Page', 'Pages', $list, $gridFieldConfig); $gridField->setAttribute('cms-loading-ignore-url-params', true); @@ -1740,6 +1898,13 @@ public function currentPageID() return $id; } + public function currentRecordID(): ?int + { + $id = parent::currentRecordID(); + $this->extend('updateCurrentPageID', $id); + return $id; + } + //------------------------------------------------------------------------------------------// // Data saving handlers @@ -1871,6 +2036,7 @@ public function getNewItem($id, $setID = true) * * @param Versioned|DataObject $record * @return mixed + * @deprecated 5.4.0 Use SilverStripe\Versioned\RecursivePublishable::publishRecursive() instead. */ public function performPublish($record) { @@ -2038,7 +2204,7 @@ public function unpublish(array $data, Form $form): HTTPResponse public function rollback() { return $this->doRollback([ - 'ID' => $this->currentPageID(), + 'ID' => $this->currentRecordID(), 'Version' => $this->getRequest()->param('VersionID') ], null); } @@ -2276,7 +2442,7 @@ protected function getCMSTreeTitle() } /** - * Cache key for SiteTreeHints() method + * Cache key for TreeHints() method * * @param $memberID * @return string diff --git a/code/Controllers/CMSPageAddController.php b/code/Controllers/CMSPageAddController.php index 59a3a5c1d3..6bfb79ee1d 100644 --- a/code/Controllers/CMSPageAddController.php +++ b/code/Controllers/CMSPageAddController.php @@ -8,6 +8,7 @@ use SilverStripe\Control\HTTPResponse; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; +use SilverStripe\Dev\Deprecation; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; use SilverStripe\Forms\FormAction; @@ -23,6 +24,9 @@ use SilverStripe\Security\Security; use SilverStripe\SiteConfig\SiteConfig; +/** + * @deprecated 5.4.0 Will be replaced with SilverStripe\CMS\Forms\CMSMainAddForm + */ class CMSPageAddController extends CMSPageEditController { @@ -40,6 +44,16 @@ class CMSPageAddController extends CMSPageEditController 'doCancel' ]; + public function __construct() + { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with SilverStripe\CMS\Forms\CMSMainAddForm', + Deprecation::SCOPE_CLASS + ); + parent::__construct(); + } + /** * @return Form */ @@ -136,7 +150,7 @@ public function AddForm() $parentModeField->addExtraClass('parent-mode'); - // CMSMain->currentPageID() automatically sets the homepage, + // CMSMain->currentRecordID() automatically sets the homepage, // which we need to counteract in the default selection (which should default to root, ID=0) if ($parentID = $this->getRequest()->getVar('ParentID')) { $parentModeField->setValue('child'); @@ -222,7 +236,7 @@ public function doAdd(array $data, Form $form): HTTPResponse $editController = CMSPageEditController::singleton(); $editController->setRequest($this->getRequest()); - $editController->setCurrentPageID($record->ID); + $editController->setCurrentRecordID($record->ID); $session = $this->getRequest()->getSession(); $session->set( diff --git a/code/Controllers/CMSPageSettingsController.php b/code/Controllers/CMSPageSettingsController.php index bf40157367..1d45d166f6 100644 --- a/code/Controllers/CMSPageSettingsController.php +++ b/code/Controllers/CMSPageSettingsController.php @@ -19,7 +19,7 @@ class CMSPageSettingsController extends CMSMain public function getEditForm($id = null, $fields = null) { - $record = $this->getRecord($id ?: $this->currentPageID()); + $record = $this->getRecord($id ?: $this->currentRecordID()); return parent::getEditForm($id, ($record) ? $record->getSettingsFields() : null); } diff --git a/code/Controllers/CMSPagesController.php b/code/Controllers/CMSPagesController.php index 98e6c630fb..14ecb60371 100644 --- a/code/Controllers/CMSPagesController.php +++ b/code/Controllers/CMSPagesController.php @@ -5,10 +5,14 @@ use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Control\Controller; use SilverStripe\Model\List\ArrayList; +use SilverStripe\Dev\Deprecation; use SilverStripe\ORM\DataObject; use SilverStripe\Model\ArrayData; use stdClass; +/** + * @deprecated 5.4.0 Will be combined back into SilverStripe\CMS\Controllers\CMSMain + */ class CMSPagesController extends CMSMain { @@ -22,6 +26,16 @@ class CMSPagesController extends CMSMain private static $required_permission_codes = 'CMS_ACCESS_CMSMain'; + public function __construct() + { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be combined back into ' . CMSMain::class, + Deprecation::SCOPE_CLASS + ); + parent::__construct(); + } + public function LinkPreview() { return false; diff --git a/code/Controllers/CMSSiteTreeFilter.php b/code/Controllers/CMSSiteTreeFilter.php index d2c4d57ce8..2ae27a4a6d 100644 --- a/code/Controllers/CMSSiteTreeFilter.php +++ b/code/Controllers/CMSSiteTreeFilter.php @@ -7,6 +7,7 @@ use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Convert; use SilverStripe\Core\Injector\Injectable; +use SilverStripe\Dev\Deprecation; use SilverStripe\Forms\DateField; use SilverStripe\ORM\DataList; use SilverStripe\Model\List\SS_List; @@ -113,8 +114,12 @@ public function getNumChildrenMethod() return $this->numChildrenMethod; } + /** + * @deprecated 5.4.0 Will be renamed to getRecordClasses() + */ public function getPageClasses($page) { + Deprecation::noticeWithNoReplacment('5.4.0', 'Will be renamed to getRecordClasses()'); if ($this->_cache_ids === null) { $this->populateIDs(); } @@ -178,8 +183,12 @@ protected function populateIDs() } } + /** + * @deprecated 5.4.0 Will be renamed to isRecordIncluded() + */ public function isPageIncluded($page) { + Deprecation::noticeWithNoReplacment('5.4.0', 'Will be renamed to isRecordIncluded()'); if ($this->_cache_ids === null) { $this->populateIDs(); } diff --git a/code/Controllers/LeftAndMainPageIconsExtension.php b/code/Controllers/LeftAndMainPageIconsExtension.php index ed0e7e69fd..13fc86473d 100644 --- a/code/Controllers/LeftAndMainPageIconsExtension.php +++ b/code/Controllers/LeftAndMainPageIconsExtension.php @@ -13,22 +13,34 @@ use SilverStripe\Core\Extension; use SilverStripe\Core\Flushable; use SilverStripe\Core\Injector\Injector; +use SilverStripe\Dev\Deprecation; use SilverStripe\View\Requirements; /** * Extension to include custom page icons * * @extends Extension + * @deprecated 5.4.0 Will be renamed to SilverStripe\CMS\Controllers\LeftAndMainRecordIconsExtension */ class LeftAndMainPageIconsExtension extends Extension implements Flushable { + public function __construct() + { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be renamed to SilverStripe\CMS\Controllers\LeftAndMainRecordIconsExtension', + Deprecation::SCOPE_CLASS + ); + parent::__construct(); + } + /** * @throws InvalidArgumentException * @throws ReflectionException */ protected function onInit() { - Requirements::customCSS($this->generatePageIconsCss(), CMSMain::PAGE_ICONS_ID); + Requirements::customCSS($this->generateRecordIconsCss(), CMSMain::CMS_RECORD_ICONS_ID); } /** @@ -39,7 +51,6 @@ public static function flush() Injector::inst()->get(CacheInterface::class . '.SiteTree_PageIcons')->clear(); } - /** * Include CSS for page icons. We're not using the JSTree 'types' option * because it causes too much performance overhead just to add some icons. @@ -47,8 +58,22 @@ public static function flush() * @return string CSS * @throws InvalidArgumentException * @throws ReflectionException + * @deprecated 5.4.0 Use generateRecordIconsCss() instead. */ public function generatePageIconsCss() + { + Deprecation::notice('5.4.0', 'Use generateRecordIconsCss() instead.'); + return $this->generateRecordIconsCss(); + } + + /** + * Include CSS for page icons. We're not using the JSTree 'types' option + * because it causes too much performance overhead just to add some icons. + * + * @throws InvalidArgumentException + * @throws ReflectionException + */ + public function generateRecordIconsCss(): string { /** @var CacheInterface $cache */ $cache = Injector::inst()->get(CacheInterface::class . '.SiteTree_PageIcons'); diff --git a/code/Model/CurrentPageIdentifier.php b/code/Model/CurrentPageIdentifier.php index bee76b8239..0228554577 100644 --- a/code/Model/CurrentPageIdentifier.php +++ b/code/Model/CurrentPageIdentifier.php @@ -6,6 +6,7 @@ /** * This interface lets us set up objects that will tell us what the current page is. + * @deprecated 5.4.0 Will be renamed to SilverStripe\CMS\Model\CurrentRecordIdentifier */ interface CurrentPageIdentifier { @@ -13,6 +14,7 @@ interface CurrentPageIdentifier /** * Get the current page ID. * @return int + * @deprecated 5.4.0 Will be renamed to currentRecordID() */ public function currentPageID(); @@ -20,6 +22,7 @@ public function currentPageID(); * Check if the given DataObject is the current page. * @param DataObject $page The page to check. * @return boolean + * @deprecated 5.4.0 Will be renamed to isCurrentRecord() */ public function isCurrentPage(DataObject $page); } diff --git a/code/Model/RedirectorPage.php b/code/Model/RedirectorPage.php index 250d602a48..9ccfda9dcf 100644 --- a/code/Model/RedirectorPage.php +++ b/code/Model/RedirectorPage.php @@ -23,6 +23,9 @@ class RedirectorPage extends Page { private static string $class_description = 'Redirects requests to another location'; + /** + * @deprecated 5.4.0 Will be renamed to cms_icon_class + */ private static $icon_class = 'font-icon-p-redirect'; private static $show_stage_link = false; diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index 2cf04fcb05..e003165f6a 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -159,6 +159,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi * * @config * @var array + * @deprecated 5.4.0 Use canCreate() instead. */ private static $need_permission = null; @@ -312,6 +313,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi * @see LeftAndMainPageIconsExtension::generatePageIconsCss() * @config * @var string + * @deprecated 5.4.0 Will be renamed to cms_icon */ private static $icon = null; @@ -319,6 +321,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi * Class attached to page icons in the CMS page tree. Also supports font-icon set. * @config * @var string + * @deprecated 5.4.0 Will be renamed to cms_icon_class */ private static $icon_class = 'font-icon-page'; @@ -523,6 +526,7 @@ public static function get_by_link($link, $cache = true) * Return a subclass map of SiteTree that shouldn't be hidden through {@link SiteTree::$hide_pagetypes} * * @return array + * @deprecated 5.4.0 Will be replaced with updateAllowedSubClasses() */ public static function page_type_classes() { @@ -940,9 +944,14 @@ public function getParent() /** * @param CacheInterface $cache * @return $this + * @deprecated 5.4.0 Will be replaced with SilverStripe\CMS\Controllers\CMSMain::setCreatableChildrenCache() */ public function setCreatableChildrenCache(CacheInterface $cache) { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with ' . CMSMain::class . '::setCreatableChildrenCache()' + ); $this->creatableChildrenCache = $cache; return $this; @@ -950,9 +959,14 @@ public function setCreatableChildrenCache(CacheInterface $cache) /** * @return CacheInterface $cache + * @deprecated 5.4.0 Will be replaced with SilverStripe\CMS\Controllers\CMSMain::getCreatableChildrenCache() */ public function getCreatableChildrenCache() { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with ' . CMSMain::class . '::getCreatableChildrenCache()' + ); return $this->creatableChildrenCache; } @@ -1267,9 +1281,11 @@ public function getSiteConfig() /** * @return PermissionChecker + * @deprecated 5.4.0 Will be replaced with a non-static method with the same name. */ public static function getPermissionChecker() { + Deprecation::noticeWithNoReplacment('5.4.0', 'Will be replaced with a non-static method with the same name.'); return Injector::inst()->get(PermissionChecker::class.'.sitetree'); } @@ -1691,9 +1707,14 @@ protected function onAfterDelete() * Flushes the member specific cache for creatable children * * @param array $memberIDs + * @deprecated 5.4.0 Will be replaced with SilverStripe\CMS\Controllers\CMSMain::clearCache() */ public function flushMemberCache($memberIDs = null) { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with ' . CMSMain::class . '::clearCache()' + ); $cache = SiteTree::singleton()->getCreatableChildrenCache(); if (!$memberIDs) { @@ -2625,9 +2646,14 @@ protected function getClassDropdown() * Gets a list of the page types that can be created under this specific page, including font icons * * @return array + * @deprecated 5.4.0 Will be replaced with SilverStripe\CMS\Controllers\CMSMain::getCreatableSubClasses() */ public function creatableChildPages() { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with ' . CMSMain::class . '::getCreatableSubClasses()' + ); // Build the list of candidate children $cache = SiteTree::singleton()->getCreatableChildrenCache(); $cacheKey = $this->generateChildrenCacheKey(Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0); @@ -2689,9 +2715,14 @@ public function setMenuTitle($value) * Returns the CSS class used for the page icon in the site tree. * * @return string + * @deprecated 5.4.0 Will be replaced with SilverStripe\CMS\Controllers\CMSMain::getRecordIconCssClass() */ public function getIconClass() { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with ' . CMSMain::class . '::getRecordIconCssClass()' + ); if ($this->config()->get('icon')) { return ''; } @@ -2928,9 +2959,14 @@ public function plural_name() * Generate link to this page's icon * * @return string + * @deprecated 5.4.0 Will be replaced with SilverStripe\CMS\Controllers\CMSMain::getRecordIconUrl() */ public function getPageIconURL() { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with ' . CMSMain::class . '::getRecordIconUrl()' + ); $icon = $this->config()->get('icon'); if (!$icon) { return null; @@ -3023,9 +3059,14 @@ protected function updateDependentPages() * * @param int $memberID * @return string + * @deprecated 5.4.0 Will be replaced with SilverStripe\CMS\Controllers\CMSMain::generateChildrenCacheKey() */ protected function generateChildrenCacheKey($memberID) { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with ' . CMSMain::class . '::generateChildrenCacheKey()' + ); return md5($memberID . '_' . __CLASS__); } diff --git a/code/Model/VirtualPage.php b/code/Model/VirtualPage.php index a734c2bc0d..1ca72ec1aa 100644 --- a/code/Model/VirtualPage.php +++ b/code/Model/VirtualPage.php @@ -30,6 +30,9 @@ class VirtualPage extends Page { private static string $class_description = 'Displays the content of another page'; + /** + * @deprecated 5.4.0 Will be renamed to cms_icon_class + */ private static $icon_class = 'font-icon-p-virtual'; public static $virtualFields; diff --git a/yarn.lock b/yarn.lock index 99d88c1ee0..dbbb41155e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3016,9 +3016,9 @@ create-jest@^29.7.0: prompts "^2.0.1" cross-spawn@^7.0.2, cross-spawn@^7.0.3: - version "7.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.5.tgz#910aac880ff5243da96b728bc6521a5f6c2f2f82" - integrity sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug== + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== dependencies: path-key "^3.1.0" shebang-command "^2.0.0"