From d3cbca700a8d1eb80a8ae8d8a2cf1a5e8ee0cb8f Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:02:27 +1300 Subject: [PATCH] API Use new class_description configuration (#1272) --- src/Models/BaseElement.php | 13 ++++++------- src/Models/ElementContent.php | 5 +++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Models/BaseElement.php b/src/Models/BaseElement.php index daf287e8..1b259ccb 100644 --- a/src/Models/BaseElement.php +++ b/src/Models/BaseElement.php @@ -66,9 +66,12 @@ class BaseElement extends DataObject implements CMSPreviewable * * @config * @var string + * @deprecated 5.4.0 use class_description instead. */ private static $description = 'Base element class'; + private static $class_description = 'Base element class'; + /** * List of fields to exclude from CMS SiteTree seatch * @see ElementSiteTreeFilterSearch::applyDefaultFilters() @@ -1140,18 +1143,14 @@ public function getIcon() /** * Get a description for this content element, if available * - * @deprecated 5.3.0 Use the description configuration property and localisation API directly instead. + * @deprecated 5.3.0 Use i18n_classDescription() instead. * * @return string */ public function getDescription() { - Deprecation::notice('5.3.0', 'Use getTypeNice() or the description configuration property directly instead.'); - $description = $this->config()->uninherited('description'); - if ($description) { - return _t(__CLASS__ . '.Description', $description); - } - return ''; + Deprecation::notice('5.3.0', 'Use i18n_classDescription() instead.'); + return $this->i18n_classDescription() ?? ''; } /** diff --git a/src/Models/ElementContent.php b/src/Models/ElementContent.php index 3bf6486c..ffbcb038 100644 --- a/src/Models/ElementContent.php +++ b/src/Models/ElementContent.php @@ -23,8 +23,13 @@ class ElementContent extends BaseElement private static $plural_name = 'content blocks'; + /** + * @deprecated 5.4.0 use class_description instead. + */ private static $description = 'HTML text block'; + private static $class_description = 'HTML text block'; + /** * Re-title the HTML field to Content *