Text::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace app\models\types;
4
5
use Yii;
6
use app\models\ContentType;
7
use yii\helpers\Html;
8
9
/**
10
 * This is the model class for Text content type.
11
 */
12
class Text extends ContentType
13
{
14
    public $html = '<span class="text bigtext">%data%</span>';
15
    public $css = '%field% { text-align: center; vertical-align: middle; }';
16
    public $input = 'text';
17
    public $output = 'text';
18
    public $usable = true;
19
    public $exemple = '@web/images/text.preview.jpg';
20
    public $canPreview = true;
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function __construct($config = [])
26
    {
27
        parent::__construct($config);
28
        $this->name = Yii::t('app', 'Text');
29
        $this->description = Yii::t('app', 'Textual content, will be adjusted to be displayed as big as possible.');
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function processData($data)
36
    {
37
        return nl2br(Html::encode($data));
38
    }
39
}
40