-
Notifications
You must be signed in to change notification settings - Fork 333
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 and update code in preparation for CMS 6 #3023
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi | |
* Used as a cache for `SiteTree::allowedChildren()` | ||
* Drastically reduces admin page load when there are a lot of page types | ||
* @var array | ||
* @deprecated 5.4.0 will be moved to SilverStripe\ORM\Hierarchy\Hierarchy->cache_allowedChildren | ||
*/ | ||
protected static $_allowedChildren = []; | ||
Comment on lines
+139
to
141
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't really have a process for deprecating non-config properties - and this one is very unlikely to be used by downstream devs anyway. I won't mention it in the changelog unless asked to. |
||
|
||
|
@@ -419,6 +420,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi | |
* | ||
* @config | ||
* @var string | ||
* @deprecated 5.4.0 use class_description instead. | ||
*/ | ||
private static $description = null; | ||
|
||
|
@@ -431,9 +433,15 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi | |
* | ||
* @config | ||
* @var string | ||
* @deprecated 5.4.0 use base_class_description instead. | ||
*/ | ||
private static $base_description = 'Generic content page'; | ||
|
||
/** | ||
* Description for Page and SiteTree classes, but not inherited by subclasses. | ||
*/ | ||
private static string $base_class_description = 'Generic content page'; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
|
@@ -3248,25 +3256,24 @@ public function getPageIconURL() | |
*/ | ||
public function classDescription() | ||
{ | ||
// Ensure base class has an appropriate description if not explicitly set, | ||
// since we can't set that config for projects. | ||
$base = in_array(static::class, [Page::class, SiteTree::class]); | ||
if ($base) { | ||
return $this->config()->get('base_description'); | ||
$baseDescription = static::config()->get('base_class_description'); | ||
emteknetnz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Fall back to the deprecated config | ||
if (!$baseDescription) { | ||
$baseDescription = static::config('base_description'); | ||
} | ||
return $baseDescription; | ||
} | ||
return $this->config()->get('description'); | ||
} | ||
|
||
/** | ||
* Get localised description for this page | ||
* | ||
* @return string|null | ||
*/ | ||
public function i18n_classDescription() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
$description = $this->classDescription(); | ||
if ($description) { | ||
return _t(static::class.'.DESCRIPTION', $description); | ||
// For all other classes, use the direct class_description config | ||
$description = parent::classDescription(); | ||
if (!$description) { | ||
// Fall back to the deprecated config | ||
$description = static::config()->get('description'); | ||
} | ||
return null; | ||
return $description; | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that while I have added the deprecation notice to subclasses to ensure notices are emitted appropriately, I will only mention the config on
SiteTree
being deprecated in the changelog.