Total Complexity | 4 |
Total Lines | 188 |
Duplicated Lines | 0 % |
Changes | 6 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class HTMLEditorConfigOptions |
||
9 | { |
||
10 | use Injectable; |
||
11 | |||
12 | use Configurable; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private static $main_editor = 'cms'; |
||
18 | |||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | private static $remove_options = [ |
||
23 | // 'cms', |
||
24 | // 'inline', |
||
25 | // 'paragraphs', |
||
26 | // 'heading', |
||
27 | // 'basic', |
||
28 | // 'basicbutton', |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * example:. |
||
33 | * |
||
34 | * ```php |
||
35 | * [ |
||
36 | * 'config1' => [ |
||
37 | * 'enabled_plugins' => [A, B, C], |
||
38 | * 'disabled_plugins' => [A, B, C], |
||
39 | * 'add_buttons' => [ |
||
40 | * 1: [A, B, C], |
||
41 | * 2: [A, B, C], |
||
42 | * 3: [A, B, C], |
||
43 | * ], |
||
44 | * 'remove_buttons' => [A, B, C], |
||
45 | * 'add_macrons' => true, |
||
46 | * 'options' => [ |
||
47 | * 'skin' => 'silverstripe', |
||
48 | * 'width' => '80ch', |
||
49 | * ], |
||
50 | * 'block_formats' => [ |
||
51 | * 'p' => 'paragraph', |
||
52 | * 'p' => 'paragraph', |
||
53 | * ] |
||
54 | * ], |
||
55 | * 'config2' => [ |
||
56 | * 'based_on' => 'config1' |
||
57 | * ] |
||
58 | * |
||
59 | * ] |
||
60 | * ``` |
||
61 | * |
||
62 | * @var array |
||
63 | */ |
||
64 | private static $editor_configs = [ |
||
65 | 'cms' => [ |
||
66 | 'remove_buttons' => [ |
||
67 | 'alignjustify', |
||
68 | 'indent', |
||
69 | 'outdent', |
||
70 | ], |
||
71 | 'add_buttons' => [ |
||
72 | 2 => ['fullscreen'], |
||
73 | ], |
||
74 | 'block_formats' => [ |
||
75 | 'p' => 'Paragraph', |
||
76 | 'h1' => 'Heading 1', |
||
77 | 'h2' => 'Heading 2', |
||
78 | 'h3' => 'Heading 3', |
||
79 | 'h4' => 'Heading 4', |
||
80 | 'h5' => 'Heading 5', |
||
81 | 'h6' => 'Heading 6', |
||
82 | 'blockquote' => 'quote', |
||
83 | ], |
||
84 | ], |
||
85 | |||
86 | 'inline' => [ |
||
87 | 'disabled_plugins' => [ |
||
88 | 'table', |
||
89 | ], |
||
90 | 'block_formats' => [ |
||
91 | 'span' => 'span', |
||
92 | ], |
||
93 | 'charmap_append' => true, |
||
94 | 'lines' => [ |
||
95 | 1 => [ |
||
96 | 'blocks', |
||
97 | 'styles', |
||
98 | 'removeformat', |
||
99 | '|', |
||
100 | 'bold', |
||
101 | 'italic', |
||
102 | 'underline', |
||
103 | '|', |
||
104 | 'sslink', |
||
105 | 'unlink', |
||
106 | 'anchor', |
||
107 | 'paste', |
||
108 | 'pastetext', |
||
109 | '|', |
||
110 | '|', |
||
111 | 'charmap', |
||
112 | '|', |
||
113 | 'code', |
||
114 | ], |
||
115 | ], |
||
116 | ], |
||
117 | |||
118 | 'paragraphs' => [ |
||
119 | 'based_on' => 'inline', |
||
120 | 'block_formats' => [ |
||
121 | 'p' => 'paragraph', |
||
122 | ], |
||
123 | ], |
||
124 | |||
125 | 'heading' => [ |
||
126 | 'based_on' => 'inline', |
||
127 | 'block_formats' => [ |
||
128 | 'h2' => 'heading', |
||
129 | ], |
||
130 | ], |
||
131 | |||
132 | 'basic' => [ |
||
133 | 'charmap_append' => true, |
||
134 | 'block_formats' => [ |
||
135 | 'h1' => 'heading 1', |
||
136 | 'h2' => 'heading 2', |
||
137 | 'h3' => 'heading 3', |
||
138 | 'p' => 'paragraph', |
||
139 | 'blockquote' => 'quote', |
||
140 | ], |
||
141 | 'lines' => [ |
||
142 | 1 => [ |
||
143 | 'paste', |
||
144 | 'pastetext', |
||
145 | '|', |
||
146 | 'ssmedia', |
||
147 | 'ssembed', |
||
148 | '|', |
||
149 | 'sslink', |
||
150 | 'unlink', |
||
151 | 'anchor', |
||
152 | '|', |
||
153 | 'charmap', |
||
154 | '|', |
||
155 | 'code', |
||
156 | 'fullscreen', |
||
157 | ], |
||
158 | 2 => [ |
||
159 | 'removeformat', |
||
160 | 'blocks', |
||
161 | 'styles', |
||
162 | '|', |
||
163 | 'bold', |
||
164 | 'italic', |
||
165 | 'underline', |
||
166 | '|', |
||
167 | 'bullist', |
||
168 | 'numlist', |
||
169 | ], |
||
170 | ], |
||
171 | ], |
||
172 | 'basicbutton' => [ |
||
173 | 'based_on' => 'basic', |
||
174 | 'options' => [ |
||
175 | 'style_formats' => [ |
||
176 | 'title' => 'Button-Link', |
||
177 | 'attributes' => ['class' => 'tiny-mce-button'], |
||
178 | 'selector' => 'a', |
||
179 | ], |
||
180 | ], |
||
181 | ], |
||
182 | ]; |
||
183 | |||
184 | public function getEditors(): array |
||
198 |