1 | <?php |
||
2 | |||
3 | namespace DNADesign\Elemental\Models; |
||
4 | |||
5 | use SilverStripe\Forms\HTMLEditor\HtmlEditorField; |
||
6 | use SilverStripe\Forms\DropdownField; |
||
7 | use SilverStripe\ORM\FieldType\DBField; |
||
8 | |||
9 | class ElementContent extends BaseElement |
||
10 | { |
||
11 | private static $icon = 'font-icon-block-content'; |
||
12 | |||
13 | private static $db = [ |
||
14 | 'HTML' => 'HTMLText' |
||
15 | ]; |
||
16 | |||
17 | private static $table_name = 'ElementContent'; |
||
18 | |||
19 | private static $singular_name = 'content block'; |
||
20 | |||
21 | private static $plural_name = 'content blocks'; |
||
22 | |||
23 | private static $description = 'HTML text block'; |
||
24 | |||
25 | /** |
||
26 | * Re-title the HTML field to Content |
||
27 | * |
||
28 | * {@inheritDoc} |
||
29 | */ |
||
30 | public function getCMSFields() |
||
31 | { |
||
32 | $this->beforeUpdateCMSFields(function ($fields) { |
||
33 | $fields |
||
34 | ->fieldByName('Root.Main.HTML') |
||
35 | ->setTitle(_t(__CLASS__ . '.ContentLabel', 'Content')); |
||
36 | }); |
||
37 | return parent::getCMSFields(); |
||
38 | } |
||
39 | |||
40 | public function getSummary() |
||
41 | { |
||
42 | return DBField::create_field('HTMLText', $this->HTML)->Summary(20); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
43 | } |
||
44 | |||
45 | public function getType() |
||
46 | { |
||
47 | return _t(__CLASS__ . '.BlockType', 'Content'); |
||
48 | } |
||
49 | } |
||
50 |