FIX: getType() function compatibility

This commit is contained in:
Tony Air 2024-04-22 14:08:36 +02:00
parent 00ae5dd095
commit 309d7b42fb
7 changed files with 26 additions and 26 deletions

View File

@ -28,14 +28,14 @@ class AccordionElement extends ElementList
private static $table_name = 'AccordionElement'; private static $table_name = 'AccordionElement';
private static $db = [ private static $db = [
'OpenFirst' => 'Boolean(0)', 'OpenFirst' => 'Boolean(0)',
'KeepOpenned' => 'Boolean(0)', 'KeepOpenned' => 'Boolean(0)',
]; ];
public function getType() public function getType(): string
{ {
return self::$singular_name; return _t(__CLASS__ . '.BlockType', self::$singular_name);
} }
public function Accordion() public function Accordion()
@ -43,15 +43,15 @@ class AccordionElement extends ElementList
return $this->Elements()->renderWith(static::class.'_AccordionArea'); return $this->Elements()->renderWith(static::class.'_AccordionArea');
} }
public function getCMSFields() public function getCMSFields()
{ {
$fields = parent::getCMSFields(); $fields = parent::getCMSFields();
$fields->addFieldsToTab('Root.Main', [ $fields->addFieldsToTab('Root.Main', [
CheckboxField::create('OpenFirst', 'Open first accordion element on page load'), CheckboxField::create('OpenFirst', 'Open first accordion element on page load'),
CheckboxField::create('KeepOpenned', 'Keep elements open'), CheckboxField::create('KeepOpenned', 'Keep elements open'),
]); ]);
return $fields; return $fields;
} }
} }

View File

@ -28,9 +28,9 @@ class CustomSnippetElement extends ElementContent
private static $table_name = 'CustomSnippetElement'; private static $table_name = 'CustomSnippetElement';
public function getType() public function getType(): string
{ {
return self::$singular_name; return _t(__CLASS__ . '.BlockType', self::$singular_name);
} }
public function getCMSFields() public function getCMSFields()

View File

@ -45,9 +45,9 @@ class InstagramElement extends BaseElement
'DisplayGallery' => true, 'DisplayGallery' => true,
]; ];
public function getType() public function getType(): string
{ {
return self::$singular_name; return _t(__CLASS__ . '.BlockType', self::$singular_name);
} }
/** /**
@ -89,7 +89,7 @@ class InstagramElement extends BaseElement
foreach ($attributes as $name => $value) { foreach ($attributes as $name => $value) {
if ($value === true) { if ($value === true) {
$value = $name; $value = $name;
} else if (is_scalar($value)) { } elseif (is_scalar($value)) {
$value = (string) $value; $value = (string) $value;
} else { } else {
$value = json_encode($value); $value = json_encode($value);

View File

@ -50,7 +50,7 @@ class MapElement extends ElementContent
public function getType(): string public function getType(): string
{ {
return self::$singular_name; return _t(__CLASS__ . '.BlockType', self::$singular_name);
} }
public function getCMSFields(): FieldList public function getCMSFields(): FieldList

View File

@ -29,6 +29,6 @@ class SidebarElement extends BaseElement
public function getType(): string public function getType(): string
{ {
return self::$singular_name; return _t(__CLASS__ . '.BlockType', self::$singular_name);
} }
} }

View File

@ -69,9 +69,9 @@ class SliderElement extends ElementSlideshow
private $items; private $items;
public function getType() public function getType(): string
{ {
return self::$singular_name; return _t(__CLASS__ . '.BlockType', self::$singular_name);
} }
protected function ratioSize($size) protected function ratioSize($size)

View File

@ -25,9 +25,9 @@ class TeamMembersElement extends BaseElement
private static $description = 'Displays random Team Members'; private static $description = 'Displays random Team Members';
public function getType() public function getType(): string
{ {
return self::$singular_name; return _t(__CLASS__ . '.BlockType', self::$singular_name);
} }
public function Members() public function Members()