mirror of
https://github.com/dnadesign/silverstripe-elemental-list.git
synced 2024-10-22 09:05:47 +00:00
fix(ElementList):
- change ElementSummary() to getSummary() and fix count functionality - fix icon path - add getType() method
This commit is contained in:
parent
c6fc9c017f
commit
73c26f6351
@ -12,7 +12,7 @@ use SilverStripe\ORM\FieldType\DBField;
|
|||||||
|
|
||||||
class ElementList extends BaseElement
|
class ElementList extends BaseElement
|
||||||
{
|
{
|
||||||
private static $icon = 'elemental-list/images/list.svg';
|
private static $icon = 'dnadesign/silverstripe-elemental-list:images/list.svg';
|
||||||
|
|
||||||
private static $has_one = [
|
private static $has_one = [
|
||||||
'Elements' => ElementalArea::class
|
'Elements' => ElementalArea::class
|
||||||
@ -36,13 +36,17 @@ class ElementList extends BaseElement
|
|||||||
|
|
||||||
private static $description = 'Orderable list of elements';
|
private static $description = 'Orderable list of elements';
|
||||||
|
|
||||||
|
public function getType()
|
||||||
|
{
|
||||||
|
return _t(__CLASS__ . '.BlockType', 'List');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return DBField
|
* @return DBField
|
||||||
*/
|
*/
|
||||||
public function ElementSummary()
|
public function getSummary()
|
||||||
{
|
{
|
||||||
$count = $this->Elements()->Count();
|
$count = $this->Elements()->Elements()->Count();
|
||||||
$suffix = $count === 1 ? 'element': 'elements';
|
$suffix = $count === 1 ? 'element': 'elements';
|
||||||
$summary = $this->ListDescription ? DBField::create_field('HTMLText', $this->ListDescription)->Summary(10) . '<br />': '';
|
$summary = $this->ListDescription ? DBField::create_field('HTMLText', $this->ListDescription)->Summary(10) . '<br />': '';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user