Skip to content

Commit b432c54

Browse files
committed
API Use new class_description configuration
1 parent eadd5ad commit b432c54

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

docs/en/04_defining-you-own-elements.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MyElement extends BaseElement
2222

2323
private static $plural_name = 'my elements';
2424

25-
private static $description = 'What my custom element does';
25+
private static $class_description = 'What my custom element does';
2626

2727
public function getCMSFields()
2828
{

src/Models/BaseElement.php

+2-8
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,8 @@ class BaseElement extends DataObject implements CMSPreviewable
6060

6161
/**
6262
* Describe the purpose of this element
63-
*
64-
* @config
65-
* @var string
6663
*/
67-
private static $description = 'Base element class';
64+
private static $class_description = 'Base element class';
6865

6966
/**
7067
* List of fields to exclude from CMS SiteTree seatch
@@ -1140,10 +1137,7 @@ public function getIcon()
11401137
*/
11411138
public function getTypeNice()
11421139
{
1143-
$description = $this->config()->uninherited('description');
1144-
if ($description) {
1145-
$description = _t(__CLASS__ . '.Description', $description);
1146-
}
1140+
$description = $this->i18nClassDescription();
11471141
$markup = ($description) ? ' <span class="element__note"> &mdash; ' . $description . '</span>' : '';
11481142

11491143
return DBField::create_field(

src/Models/ElementContent.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ElementContent extends BaseElement
2323

2424
private static $plural_name = 'content blocks';
2525

26-
private static $description = 'HTML text block';
26+
private static $class_description = 'HTML text block';
2727

2828
/**
2929
* Re-title the HTML field to Content

0 commit comments

Comments
 (0)