Skip to content

Commit

Permalink
API Use new class_description configuration (silverstripe#1272)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Nov 14, 2024
1 parent 5f8f754 commit d3cbca7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Models/BaseElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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() ?? '';
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/Models/ElementContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit d3cbca7

Please sign in to comment.