Completed
Push — master ( 1285bd...aa4c59 )
by Julito
12:22
created

SurveyQuestion::getMaximizedToolbar()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 43
Code Lines 37

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 37
c 1
b 0
f 0
nc 8
nop 0
dl 0
loc 43
rs 9.328
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
6
7
/**
8
 * Class SurveyQuestion.
9
 */
10
class SurveyQuestion extends Basic
11
{
12
    /**
13
     * Get the toolbar config.
14
     *
15
     * @return array
16
     */
17
    public function getConfig()
18
    {
19
        if ('true' != api_get_setting('more_buttons_maximized_mode')) {
20
            $config['toolbar'] = $this->getNormalToolbar();
0 ignored issues
show
Comprehensibility Best Practice introduced by
$config was never initialized. Although not strictly required by PHP, it is generally a good practice to add $config = array(); before regardless.
Loading history...
21
        } else {
22
            $config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
23
            $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
24
        }
25
26
        return $config;
27
    }
28
29
    /**
30
     * Get the toolbar configuration when CKEditor is maximized.
31
     *
32
     * @return array
33
     */
34
    protected function getMaximizedToolbar()
35
    {
36
        return [
37
            $this->getNewPageBlock(),
38
            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'],
39
            ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
40
            ['Link', 'Unlink', 'Anchor', 'Glossary'],
41
            [
42
                'Image',
43
                'Mapping',
44
                'Video',
45
                'Oembed',
46
                'Flash',
47
                'Youtube',
48
                'Audio',
49
                'leaflet',
50
                'Smiley',
51
                'SpecialChar',
52
                'Asciimath',
53
                'Asciisvg',
54
            ],
55
            '/',
56
            ['Table', '-', 'CreateDiv'],
57
            ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
58
            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
59
            [
60
                'Bold',
61
                'Italic',
62
                'Underline',
63
                'Strike',
64
                '-',
65
                'Subscript',
66
                'Superscript',
67
                '-',
68
                'TextColor',
69
                'BGColor',
70
                api_get_configuration_value('translate_html') ? 'Language' : '',
71
            ],
72
            ['true' == api_get_setting('allow_spellcheck') ? 'Scayt' : ''],
73
            ['Styles', 'Format', 'Font', 'FontSize'],
74
            ['PageBreak', 'ShowBlocks'],
75
            'true' == api_get_setting('enabled_wiris') ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
76
            ['Toolbarswitch', 'Source'],
77
        ];
78
    }
79
80
    /**
81
     * Get the toolbar configuration when CKEditor is minimized.
82
     *
83
     * @return array
84
     */
85
    protected function getMinimizedToolbar()
86
    {
87
        return [
88
            $this->getNewPageBlock(),
89
            ['Undo', 'Redo'],
90
            ['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
91
            ['BulletedList', 'NumberedList', 'HorizontalRule'],
92
            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
93
            [
94
                'Styles',
95
                'Format',
96
                'Font',
97
                'FontSize',
98
                'Bold',
99
                'Italic',
100
                'Underline',
101
                'TextColor',
102
                'BGColor',
103
                api_get_configuration_value('translate_html') ? 'Language' : '',
104
            ],
105
            'true' == api_get_setting('enabled_wiris') ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
106
            ['Toolbarswitch', 'Source'],
107
        ];
108
    }
109
}
110