MarkupElement   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 18
c 2
b 0
f 0
dl 0
loc 27
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCMSFields() 0 11 1
A getType() 0 3 1
1
<?php
2
3
namespace DorsetDigital\Elements;
4
5
use DNADesign\Elemental\Models\BaseElement;
6
use SilverStripe\Forms\LiteralField;
7
use SilverStripe\Forms\TextareaField;
8
9
class MarkupElement extends BaseElement
10
{
11
    private static $singular_name = 'Markup';
12
    private static $plural_name = 'Markup';
13
    private static $description = 'Adds arbitrary markup to a page';
14
    private static $table_name = 'DD_Elements_Markup';
15
    private static $icon = 'font-icon-p-code';
16
    private static $db = [
17
        'Markup' => 'HTMLText'
18
    ];
19
20
    public function getCMSFields()
21
    {
22
        $fields = parent::getCMSFields();
23
        $fields->addFieldToTab('Root.Main',
24
            TextareaField::create('Markup')->setTitle(_t(__CLASS__ . '.ContentTitle', 'Markup')));
25
        $fields->addFieldToTab('Root.Main',
26
            LiteralField::create('Warning',
27
                '<p><strong>' . _t(__CLASS__ . '.MarkupWarning',
28
                    "Warning! This field is not validated.  Code entered here may break your page!  Proceed with caution!") . '</strong></p>')
29
                ->addExtraClass('form__field-label'));
30
        return $fields;
31
    }
32
33
    public function getType()
34
    {
35
        return 'Markup';
36
    }
37
}
38