ContentBlock::getPlain()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Cita\Modular\Model;
4
5
use SilverStripe\View\Parsers\ShortcodeParser;
6
use SilverStripe\ORM\FieldType\DBHTMLText;
7
8
class ContentBlock extends Block
9
{
10
    /**
11
     * Defines the database table name
12
     *  @var string
13
     */
14
    private static $table_name = 'Cita_Modular_ContentBlock';
15
16
    private static $icon_class = 'font-icon-block-content';
17
18
    /**
19
     * Singular name for CMS
20
     *  @var string
21
     */
22
    private static $singular_name = 'Content block';
23
24
    /**
25
     * Database fields
26
     * @var array
27
     */
28
    private static $db = [
29
        'Content' => 'HTMLText',
30
    ];
31
32
    public function getPlain()
33
    {
34
        return "<h2>" . $this->Title . "</h2>" . $this->Content;
35
    }
36
37
    public function getBlockSummary()
38
    {
39
        return DBHTMLText::create()->setValue(strip_tags(ShortcodeParser::get_active()->parse($this->Content)))->Summary(15);
40
    }
41
}
42