Skip to content

Commit

Permalink
API Use new class_description configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Nov 10, 2024
1 parent cce5110 commit 33e17ed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/en/04_defining-you-own-elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
10 changes: 2 additions & 8 deletions src/Models/BaseElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) ? ' <span class="element__note"> &mdash; ' . $description . '</span>' : '';

return DBField::create_field(
Expand Down
2 changes: 1 addition & 1 deletion src/Models/ElementContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 33e17ed

Please sign in to comment.