1 | <?php |
||
21 | class CKEditorInline extends Widget |
||
22 | { |
||
23 | use CKEditorTrait; |
||
24 | |||
25 | /** |
||
26 | * @var array the HTML attributes for the input tag. |
||
27 | * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. |
||
28 | */ |
||
29 | public $options = []; |
||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | public $tag = 'div'; |
||
34 | /** |
||
35 | * @var bool disables creating the inline editor automatically for elements with contenteditable attribute |
||
36 | * set to the true. Defaults to true. |
||
37 | */ |
||
38 | public $disableAutoInline = true; |
||
39 | |||
40 | /** |
||
41 | * @inheritdoc |
||
42 | */ |
||
43 | 1 | public function init() |
|
44 | { |
||
45 | 1 | if (!isset($this->options['id'])) { |
|
46 | 1 | $this->options['id'] = $this->getId(); |
|
47 | 1 | } |
|
48 | 1 | $this->options['contenteditable'] = 'true'; |
|
49 | |||
50 | 1 | parent::init(); |
|
51 | |||
52 | 1 | $this->initOptions(); |
|
53 | |||
54 | 1 | echo Html::beginTag($this->tag, $this->options); |
|
55 | 1 | } |
|
56 | |||
57 | /** |
||
58 | * @inheritdoc |
||
59 | */ |
||
60 | 1 | public function run() |
|
61 | { |
||
62 | 1 | echo Html::endTag($this->tag); |
|
63 | |||
64 | 1 | $this->registerPlugin(); |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * Registers CKEditor plugin |
||
69 | * @codeCoverageIgnore |
||
70 | */ |
||
71 | protected function registerPlugin() |
||
96 | } |
||
97 |