From 33e17ed64d26cd2890433a43ca291af8446d749a Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Thu, 7 Nov 2024 16:25:20 +1300 Subject: [PATCH] API Use new class_description configuration --- docs/en/04_defining-you-own-elements.md | 2 +- src/Models/BaseElement.php | 10 ++-------- src/Models/ElementContent.php | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/docs/en/04_defining-you-own-elements.md b/docs/en/04_defining-you-own-elements.md index fb52099e..c5c5b37e 100644 --- a/docs/en/04_defining-you-own-elements.md +++ b/docs/en/04_defining-you-own-elements.md @@ -22,7 +22,7 @@ class MyElement extends BaseElement private static $plural_name = 'my elements'; - private static $description = 'What my custom element does'; + private static $class_description = 'What my custom element does'; public function getCMSFields() { diff --git a/src/Models/BaseElement.php b/src/Models/BaseElement.php index dc1adccf..867ac208 100644 --- a/src/Models/BaseElement.php +++ b/src/Models/BaseElement.php @@ -60,11 +60,8 @@ class BaseElement extends DataObject implements CMSPreviewable /** * Describe the purpose of this element - * - * @config - * @var string */ - private static $description = 'Base element class'; + private static $class_description = 'Base element class'; /** * List of fields to exclude from CMS SiteTree seatch @@ -1119,10 +1116,7 @@ public function getIcon() */ public function getTypeNice() { - $description = $this->config()->uninherited('description'); - if ($description) { - $description = _t(__CLASS__ . '.Description', $description); - } + $description = $this->i18n_classDescription(); $markup = ($description) ? ' — ' . $description . '' : ''; return DBField::create_field( diff --git a/src/Models/ElementContent.php b/src/Models/ElementContent.php index 3bf6486c..e79a31be 100644 --- a/src/Models/ElementContent.php +++ b/src/Models/ElementContent.php @@ -23,7 +23,7 @@ class ElementContent extends BaseElement private static $plural_name = 'content blocks'; - private static $description = 'HTML text block'; + private static $class_description = 'HTML text block'; /** * Re-title the HTML field to Content