PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.3
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.3
4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 All 201 releases
← All changes | includes/Editors/Elementor/Widget/ToC.php +677 -508 3.4.1 → 4.9.3 View file →
@@ -1,9 +1,9 @@
1 1 <?php
2 2 namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget;
3 3
4 4 if ( ! defined( 'ABSPATH' ) ) {
5 - exit; // Exit if accessed directly
5 + exit; // Exit if accessed directly
6 6 }
7 7
8 8 use Elementor\Core\Schemes;
9 9 use Elementor\Controls_Manager;
@@ -14,566 +14,735 @@
14 14 use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget;
15 15
16 16 class ToC extends BaseWidget {
17 17
18 - public function get_name() {
19 - return 'betterdocs-toc';
20 - }
18 + public function get_name() {
19 + return 'betterdocs-toc';
20 + }
21 21
22 - public function get_title() {
23 - return __( 'Doc Table of Contents', 'betterdocs' );
24 - }
22 + public function get_title() {
23 + return __( 'Doc Table of Contents', 'betterdocs' );
24 + }
25 25
26 - public function get_icon() {
27 - return 'betterdocs-icon-Sidebar';
28 - }
26 + public function get_icon() {
27 + return 'betterdocs-icon-Sidebar';
28 + }
29 29
30 - public function get_categories() {
31 - return ['betterdocs-elements-single'];
32 - }
30 + public function get_categories() {
31 + return [ 'betterdocs-elements-single' ];
32 + }
33 33
34 - public function get_keywords() {
35 - return ['betterdocs-elements', 'toc', 'table-of-content', 'betterdocs', 'docs'];
36 - }
34 + public function get_keywords() {
35 + return [ 'betterdocs-elements', 'toc', 'table-of-content', 'betterdocs', 'docs' ];
36 + }
37 37
38 - public function get_style_depends() {
39 - return ['betterdocs-toc'];
40 - }
38 + public function get_style_depends() {
39 + return [ 'betterdocs-toc' ];
40 + }
41 41
42 - public function get_custom_help_url() {
43 - return 'https://betterdocs.co/docs/single-doc-in-elementor';
44 - }
42 + public function get_custom_help_url() {
43 + return 'https://betterdocs.co/docs/single-doc-in-elementor';
44 + }
45 45
46 - protected function register_controls() {
47 - $this->list_options();
46 + protected function register_controls() {
47 + $this->list_options();
48 48
49 - $this->box_setting_style();
49 + $this->box_setting_style();
50 50
51 - $this->title_settings();
51 + $this->title_settings();
52 52
53 - $this->list_settings();
54 - }
53 + $this->list_settings();
54 + }
55 55
56 - public function list_options() {
57 - $this->start_controls_section(
58 - 'section_options',
59 - [
60 - 'label' => __( 'Controls', 'betterdocs' )
61 - ]
62 - );
56 + public function list_options() {
57 + $this->start_controls_section(
58 + 'section_options',
59 + [
60 + 'label' => __( 'Controls', 'betterdocs' )
61 + ]
62 + );
63 63
64 - $this->add_control(
65 - 'toc_title',
66 - [
67 - 'label' => __( 'TOC Title', 'betterdocs' ),
68 - 'type' => Controls_Manager::TEXT,
69 - 'default' => esc_html__( 'Table of contents', 'betterdocs' )
70 - ]
71 - );
64 + $this->add_control(
65 + 'toc_title',
66 + [
67 + 'label' => __( 'TOC Title', 'betterdocs' ),
68 + 'type' => Controls_Manager::TEXT,
69 + 'default' => esc_html__( 'Table of contents', 'betterdocs' )
70 + ]
71 + );
72 72
73 - $this->add_control(
74 - 'htags',
75 - [
76 - 'label' => __( 'Supported Heading Tags', 'betterdocs' ),
77 - 'type' => Controls_Manager::SELECT2,
78 - 'multiple' => true,
79 - 'options' => [
80 - '1' => __( 'H1', 'betterdocs' ),
81 - '2' => __( 'H2', 'betterdocs' ),
82 - '3' => __( 'H3', 'betterdocs' ),
83 - '4' => __( 'H4', 'betterdocs' ),
84 - '5' => __( 'H5', 'betterdocs' ),
85 - '6' => __( 'H6', 'betterdocs' )
86 - ],
87 - 'default' => ['1', '2', '3', '4', '5', '6']
88 - ]
89 - );
73 + $this->add_control(
74 + 'htags',
75 + [
76 + 'label' => __( 'Supported Heading Tags', 'betterdocs' ),
77 + 'type' => Controls_Manager::SELECT2,
78 + 'multiple' => true,
79 + 'options' => [
80 + '1' => __( 'H1', 'betterdocs' ),
81 + '2' => __( 'H2', 'betterdocs' ),
82 + '3' => __( 'H3', 'betterdocs' ),
83 + '4' => __( 'H4', 'betterdocs' ),
84 + '5' => __( 'H5', 'betterdocs' ),
85 + '6' => __( 'H6', 'betterdocs' )
86 + ],
87 + 'default' => [ '1', '2', '3', '4', '5', '6' ]
88 + ]
89 + );
90 90
91 - $this->add_responsive_control(
92 - 'list_hierarchy',
93 - [
94 - 'label' => __( 'List Hierarchy', 'betterdocs' ),
95 - 'type' => Controls_Manager::SWITCHER,
96 - 'label_on' => __( 'Show', 'betterdocs' ),
97 - 'label_off' => __( 'Hide', 'betterdocs' ),
98 - 'return_value' => '1',
99 - 'default' => '1'
100 - ]
101 - );
91 + $this->add_responsive_control(
92 + 'list_hierarchy',
93 + [
94 + 'label' => __( 'List Hierarchy', 'betterdocs' ),
95 + 'type' => Controls_Manager::SWITCHER,
96 + 'label_on' => __( 'Show', 'betterdocs' ),
97 + 'label_off' => __( 'Hide', 'betterdocs' ),
98 + 'return_value' => '1',
99 + 'default' => '1'
100 + ]
101 + );
102 102
103 - $this->add_responsive_control(
104 - 'list_number',
105 - [
106 - 'label' => __( 'List Number', 'betterdocs' ),
107 - 'type' => Controls_Manager::SWITCHER,
108 - 'label_on' => __( 'Show', 'betterdocs' ),
109 - 'label_off' => __( 'Hide', 'betterdocs' ),
110 - 'return_value' => '1',
111 - 'default' => '1'
112 - ]
113 - );
103 + $this->add_responsive_control(
104 + 'list_number',
105 + [
106 + 'label' => __( 'List Number', 'betterdocs' ),
107 + 'type' => Controls_Manager::SWITCHER,
108 + 'label_on' => __( 'Show', 'betterdocs' ),
109 + 'label_off' => __( 'Hide', 'betterdocs' ),
110 + 'return_value' => '1',
111 + 'default' => '1'
112 + ]
113 + );
114 114
115 - $this->add_responsive_control(
116 - 'collapsible_toc_mobile',
117 - [
118 - 'label' => __( 'Collapsible on small devices', 'betterdocs' ),
119 - 'type' => Controls_Manager::SWITCHER,
120 - 'label_on' => __( 'Show', 'betterdocs' ),
121 - 'label_off' => __( 'Hide', 'betterdocs' ),
122 - 'return_value' => '1',
123 - 'default' => ''
124 - ]
125 - );
115 + $this->add_responsive_control(
116 + 'collapsible_toc_mobile',
117 + [
118 + 'label' => __( 'Collapsible on small devices', 'betterdocs' ),
119 + 'type' => Controls_Manager::SWITCHER,
120 + 'label_on' => __( 'Show', 'betterdocs' ),
121 + 'label_off' => __( 'Hide', 'betterdocs' ),
122 + 'return_value' => '1',
123 + 'default' => ''
124 + ]
125 + );
126 126
127 - $this->end_controls_section();
128 - }
127 + $this->end_controls_section();
128 + }
129 129
130 - public function box_setting_style() {
131 - /**
132 - * ----------------------------------------------------------
133 - * Section: Box Styles
134 - * ----------------------------------------------------------
135 - */
136 - $this->start_controls_section(
137 - 'section_card_settings',
138 - [
139 - 'label' => __( 'Box', 'betterdocs' ),
140 - 'tab' => Controls_Manager::TAB_STYLE
141 - ]
142 - );
130 + public function box_setting_style() {
131 + /**
132 + * ----------------------------------------------------------
133 + * Section: Box Styles
134 + * ----------------------------------------------------------
135 + */
136 + $this->start_controls_section(
137 + 'section_card_settings',
138 + [
139 + 'label' => __( 'Box', 'betterdocs' ),
140 + 'tab' => Controls_Manager::TAB_STYLE
141 + ]
142 + );
143 143
144 - $this->add_responsive_control(
145 - 'column_width', // Legacy control id but new control
146 - [
147 - 'label' => __( 'Box Width (%)', 'betterdocs' ),
148 - 'type' => Controls_Manager::NUMBER,
149 - 'min' => 0,
150 - 'max' => 100,
151 - 'step' => 5,
152 - 'default' => 100,
153 - 'selectors' => [
154 - '{{WRAPPER}} .betterdocs-toc' => 'width: {{VALUE}}%;'
155 - ]
156 - ]
157 - );
144 + $this->add_responsive_control(
145 + 'column_width', // Legacy control id but new control
146 + [
147 + 'label' => __( 'Box Width (%)', 'betterdocs' ),
148 + 'type' => Controls_Manager::NUMBER,
149 + 'min' => 0,
150 + 'max' => 100,
151 + 'step' => 5,
152 + 'default' => 100,
153 + 'selectors' => [
154 + '{{WRAPPER}} .betterdocs-toc' => 'width: {{VALUE}}%;'
155 + ]
156 + ]
157 + );
158 158
159 - $this->add_responsive_control(
160 - 'column_background',
161 - [
162 - 'label' => esc_html__( 'Background Color', 'betterdocs' ),
163 - 'type' => Controls_Manager::COLOR,
164 - 'selectors' => [
165 - '{{WRAPPER}} .betterdocs-toc' => 'background-color: {{VALUE}};'
166 - ]
167 - ]
168 - );
159 + $this->add_responsive_control(
160 + 'column_background',
161 + [
162 + 'label' => esc_html__( 'Background Color', 'betterdocs' ),
163 + 'type' => Controls_Manager::COLOR,
164 + 'selectors' => [
165 + '{{WRAPPER}} .betterdocs-toc' => 'background-color: {{VALUE}};'
166 + ]
167 + ]
168 + );
169 169
170 - $this->add_responsive_control(
171 - 'column_space', // Legacy control id but new control
172 - [
173 - 'label' => __( 'Box Spacing', 'betterdocs' ),
174 - 'type' => Controls_Manager::DIMENSIONS,
175 - 'size_units' => ['px', '%', 'em'],
176 - 'selectors' => [
177 - '{{WRAPPER}} .betterdocs-toc' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
178 - ]
179 - ]
180 - );
170 + $this->add_responsive_control(
171 + 'column_space', // Legacy control id but new control
172 + [
173 + 'label' => __( 'Box Spacing', 'betterdocs' ),
174 + 'type' => Controls_Manager::DIMENSIONS,
175 + 'size_units' => [ 'px', '%', 'em' ],
176 + 'selectors' => [
177 + '{{WRAPPER}} .betterdocs-toc' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
178 + ]
179 + ]
180 + );
181 181
182 - $this->add_responsive_control(
183 - 'column_padding',
184 - [
185 - 'label' => __( 'Box Padding', 'betterdocs' ),
186 - 'type' => Controls_Manager::DIMENSIONS,
187 - 'size_units' => ['px', 'em', '%'],
188 - 'selectors' => [
189 - '{{WRAPPER}} .betterdocs-toc' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
190 - ]
191 - ]
192 - );
182 + $this->add_responsive_control(
183 + 'column_padding',
184 + [
185 + 'label' => __( 'Box Padding', 'betterdocs' ),
186 + 'type' => Controls_Manager::DIMENSIONS,
187 + 'size_units' => [ 'px', 'em', '%' ],
188 + 'selectors' => [
189 + '{{WRAPPER}} .betterdocs-toc' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
190 + ]
191 + ]
192 + );
193 193
194 - $this->add_responsive_control(
195 - 'column_border_radius',
196 - [
197 - 'label' => esc_html__( 'Box Border Radius', 'betterdocs' ),
198 - 'type' => Controls_Manager::DIMENSIONS,
199 - 'size_units' => ['px', 'em', '%'],
200 - 'selectors' => [
201 - '{{WRAPPER}} .betterdocs-toc' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
202 - ]
203 - ]
204 - );
194 + $this->add_responsive_control(
195 + 'column_border_radius',
196 + [
197 + 'label' => esc_html__( 'Box Border Radius', 'betterdocs' ),
198 + 'type' => Controls_Manager::DIMENSIONS,
199 + 'size_units' => [ 'px', 'em', '%' ],
200 + 'selectors' => [
201 + '{{WRAPPER}} .betterdocs-toc' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
202 + ]
203 + ]
204 + );
205 205
206 - $this->add_responsive_control(
207 - 'align',
208 - [
209 - 'label' => __( 'Alignment', 'betterdocs' ),
210 - 'type' => Controls_Manager::CHOOSE,
211 - 'options' => [
212 - 'left' => [
213 - 'title' => __( 'Left', 'betterdocs' ),
214 - 'icon' => 'eicon-text-align-left'
215 - ],
216 - 'center' => [
217 - 'title' => __( 'Center', 'betterdocs' ),
218 - 'icon' => 'eicon-text-align-center'
219 - ],
220 - 'right' => [
221 - 'title' => __( 'Right', 'betterdocs' ),
222 - 'icon' => 'eicon-text-align-right'
223 - ],
224 - 'justify' => [
225 - 'title' => __( 'Justified', 'betterdocs' ),
226 - 'icon' => 'eicon-text-align-justify'
227 - ]
228 - ],
229 - 'default' => '',
230 - 'selectors' => [
231 - '{{WRAPPER}}' => 'text-align: {{VALUE}};'
232 - ]
233 - ]
234 - );
206 + $this->add_responsive_control(
207 + 'align',
208 + [
209 + 'label' => __( 'Alignment', 'betterdocs' ),
210 + 'type' => Controls_Manager::CHOOSE,
211 + 'options' => [
212 + 'left' => [
213 + 'title' => __( 'Left', 'betterdocs' ),
214 + 'icon' => 'eicon-text-align-left'
215 + ],
216 + 'center' => [
217 + 'title' => __( 'Center', 'betterdocs' ),
218 + 'icon' => 'eicon-text-align-center'
219 + ],
220 + 'right' => [
221 + 'title' => __( 'Right', 'betterdocs' ),
222 + 'icon' => 'eicon-text-align-right'
223 + ],
224 + 'justify' => [
225 + 'title' => __( 'Justified', 'betterdocs' ),
226 + 'icon' => 'eicon-text-align-justify'
227 + ]
228 + ],
229 + 'default' => '',
230 + 'selectors' => [
231 + '{{WRAPPER}}' => 'text-align: {{VALUE}};'
232 + ]
233 + ]
234 + );
235 235
236 - $this->end_controls_section(); # end of 'Card Settings'
237 - }
236 + $this->end_controls_section(); # end of 'Card Settings'
237 + }
238 238
239 - public function title_settings() {
240 - $this->start_controls_section(
241 - 'section_title',
242 - [
243 - 'label' => __( 'Title', 'betterdocs' ),
244 - 'tab' => Controls_Manager::TAB_STYLE
245 - ]
246 - );
239 + public function title_settings() {
240 + $this->start_controls_section(
241 + 'section_title',
242 + [
243 + 'label' => __( 'Title', 'betterdocs' ),
244 + 'tab' => Controls_Manager::TAB_STYLE
245 + ]
246 + );
247 247
248 - $this->add_control(
249 - 'title_color',
250 - [
251 - 'label' => __( 'Text Color', 'betterdocs' ),
252 - 'type' => Controls_Manager::COLOR,
253 - 'scheme' => [
254 - 'type' => Schemes\Color::get_type(),
255 - 'value' => Schemes\Color::COLOR_1
256 - ],
257 - 'selectors' => [
258 - '{{WRAPPER}} .betterdocs-toc .toc-title' => 'color: {{VALUE}};'
259 - ]
260 - ]
261 - );
248 + $this->add_control(
249 + 'title_color',
250 + [
251 + 'label' => __( 'Text Color', 'betterdocs' ),
252 + 'type' => Controls_Manager::COLOR,
253 + 'selectors' => [
254 + '{{WRAPPER}} .betterdocs-toc .toc-title' => 'color: {{VALUE}};'
255 + ]
256 + ]
257 + );
262 258
263 - $this->add_group_control(
264 - Group_Control_Typography::get_type(),
265 - [
266 - 'name' => 'typography',
267 - 'selector' => '{{WRAPPER}} .betterdocs-toc .toc-title'
268 - ]
269 - );
259 + $this->add_group_control(
260 + Group_Control_Typography::get_type(),
261 + [
262 + 'name' => 'typography',
263 + 'selector' => '{{WRAPPER}} .betterdocs-toc .toc-title'
264 + ]
265 + );
270 266
271 - $this->add_group_control(
272 - Group_Control_Text_Shadow::get_type(),
273 - [
274 - 'name' => 'text_shadow',
275 - 'selector' => '{{WRAPPER}} .betterdocs-toc .toc-title'
276 - ]
277 - );
267 + $this->add_group_control(
268 + Group_Control_Text_Shadow::get_type(),
269 + [
270 + 'name' => 'text_shadow',
271 + 'selector' => '{{WRAPPER}} .betterdocs-toc .toc-title'
272 + ]
273 + );
278 274
279 - $this->add_control(
280 - 'blend_mode',
281 - [
282 - 'label' => __( 'Blend Mode', 'betterdocs' ),
283 - 'type' => Controls_Manager::SELECT,
284 - 'options' => [
285 - '' => __( 'Normal', 'betterdocs' ),
286 - 'multiply' => 'Multiply',
287 - 'screen' => 'Screen',
288 - 'overlay' => 'Overlay',
289 - 'darken' => 'Darken',
290 - 'lighten' => 'Lighten',
291 - 'color-dodge' => 'Color Dodge',
292 - 'saturation' => 'Saturation',
293 - 'color' => 'Color',
294 - 'difference' => 'Difference',
295 - 'exclusion' => 'Exclusion',
296 - 'hue' => 'Hue',
297 - 'luminosity' => 'Luminosity'
298 - ],
299 - 'selectors' => [
300 - '{{WRAPPER}} .betterdocs-toc .toc-title' => 'mix-blend-mode: {{VALUE}}'
301 - ],
302 - 'separator' => 'none'
303 - ]
304 - );
275 + $this->add_control(
276 + 'blend_mode',
277 + [
278 + 'label' => __( 'Blend Mode', 'betterdocs' ),
279 + 'type' => Controls_Manager::SELECT,
280 + 'options' => [
281 + '' => __( 'Normal', 'betterdocs' ),
282 + 'multiply' => 'Multiply',
283 + 'screen' => 'Screen',
284 + 'overlay' => 'Overlay',
285 + 'darken' => 'Darken',
286 + 'lighten' => 'Lighten',
287 + 'color-dodge' => 'Color Dodge',
288 + 'saturation' => 'Saturation',
289 + 'color' => 'Color',
290 + 'difference' => 'Difference',
291 + 'exclusion' => 'Exclusion',
292 + 'hue' => 'Hue',
293 + 'luminosity' => 'Luminosity'
294 + ],
295 + 'selectors' => [
296 + '{{WRAPPER}} .betterdocs-toc .toc-title' => 'mix-blend-mode: {{VALUE}}'
297 + ],
298 + 'separator' => 'none'
299 + ]
300 + );
305 301
306 - $this->add_responsive_control(
307 - 'title_padding',
308 - [
309 - 'label' => esc_html__( 'Title Padding', 'betterdocs' ),
310 - 'type' => Controls_Manager::DIMENSIONS,
311 - 'size_units' => ['px', 'em', '%'],
312 - 'selectors' => [
313 - '{{WRAPPER}} .betterdocs-toc .toc-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
314 - ]
315 - ]
316 - );
302 + $this->add_responsive_control(
303 + 'title_padding',
304 + [
305 + 'label' => esc_html__( 'Title Padding', 'betterdocs' ),
306 + 'type' => Controls_Manager::DIMENSIONS,
307 + 'size_units' => [ 'px', 'em', '%' ],
308 + 'selectors' => [
309 + '{{WRAPPER}} .betterdocs-toc .toc-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
310 + ]
311 + ]
312 + );
317 313
318 - $this->add_responsive_control(
319 - 'title_margin',
320 - [
321 - 'label' => esc_html__( 'Title Margin', 'betterdocs' ),
322 - 'type' => Controls_Manager::DIMENSIONS,
323 - 'size_units' => ['px', 'em', '%'],
324 - 'selectors' => [
325 - '{{WRAPPER}} .betterdocs-toc .toc-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
326 - ]
327 - ]
328 - );
314 + $this->add_responsive_control(
315 + 'title_margin',
316 + [
317 + 'label' => esc_html__( 'Title Margin', 'betterdocs' ),
318 + 'type' => Controls_Manager::DIMENSIONS,
319 + 'size_units' => [ 'px', 'em', '%' ],
320 + 'selectors' => [
321 + '{{WRAPPER}} .betterdocs-toc .toc-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
322 + ]
323 + ]
324 + );
329 325
330 - $this->end_controls_section();
326 + $this->end_controls_section();
331 327
332 - $this->update_control(
333 - 'title',
334 - [
335 - 'dynamic' => [
336 - 'default' => ElementorProPlugin::elementor()->dynamic_tags->tag_data_to_tag_text( null, 'betterdocs-title-tag' )
337 - ]
338 - ],
339 - [
340 - 'recursive' => true
341 - ]
342 - );
343 - }
328 + $this->update_control(
329 + 'title',
330 + [
331 + 'dynamic' => [
332 + 'default' => ElementorProPlugin::elementor()->dynamic_tags->tag_data_to_tag_text( null, 'betterdocs-title-tag' )
333 + ]
334 + ],
335 + [
336 + 'recursive' => true
337 + ]
338 + );
339 + }
344 340
345 - public function list_settings() {
346 - /**
347 - * ----------------------------------------------------------
348 - * Section: List Settinggs
349 - * ----------------------------------------------------------
350 - */
351 - $this->start_controls_section(
352 - 'section_article_settings',
353 - [
354 - 'label' => __( 'Toc List', 'betterdocs' ),
355 - 'tab' => Controls_Manager::TAB_STYLE
356 - ]
357 - );
341 + public function list_settings() {
342 + /**
343 + * ----------------------------------------------------------
344 + * Section: List Settinggs
345 + * ----------------------------------------------------------
346 + */
347 + $this->start_controls_section(
348 + 'section_article_settings',
349 + [
350 + 'label' => __( 'Toc List', 'betterdocs' ),
351 + 'tab' => Controls_Manager::TAB_STYLE
352 + ]
353 + );
358 354
359 - $this->add_group_control(
360 - Group_Control_Typography::get_type(),
361 - [
362 - 'name' => 'list_item_typography',
363 - 'selector' => '{{WRAPPER}} .betterdocs-toc ul li a'
364 - ]
365 - );
355 + $this->add_group_control(
356 + Group_Control_Typography::get_type(),
357 + [
358 + 'name' => 'list_item_typography',
359 + 'selector' => '{{WRAPPER}} .betterdocs-toc ul li a'
360 + ]
361 + );
366 362
367 - $this->add_control(
368 - 'list_word_wrap',
369 - [
370 - 'label' => __( 'Word Wrap', 'betterdocs' ),
371 - 'type' => Controls_Manager::SELECT2,
372 - 'multiple' => false,
373 - 'options' => [
374 - 'normal' => 'normal',
375 - 'break-word' => 'break-word',
376 - 'initial' => 'initial',
377 - 'inherit' => 'inherit'
378 - ],
379 - 'default' => 'normal',
380 - 'selectors' => [
381 - '{{WRAPPER}} .betterdocs-toc ul li a' => 'word-wrap: {{VALUE}};'
382 - ]
383 - ]
384 - );
363 + $this->add_control(
364 + 'list_word_wrap',
365 + [
366 + 'label' => __( 'Word Wrap', 'betterdocs' ),
367 + 'type' => Controls_Manager::SELECT2,
368 + 'multiple' => false,
369 + 'options' => [
370 + 'normal' => 'normal',
371 + 'break-word' => 'break-word',
372 + 'initial' => 'initial',
373 + 'inherit' => 'inherit'
374 + ],
375 + 'default' => 'normal',
376 + 'selectors' => [
377 + '{{WRAPPER}} .betterdocs-toc ul li a' => 'word-wrap: {{VALUE}};'
378 + ]
379 + ]
380 + );
385 381
386 - $this->add_responsive_control(
387 - 'list_border_left_full',
388 - [
389 - 'label' => __( 'Left Border Line', 'betterodcs' ),
390 - 'type' => Controls_Manager::SLIDER,
391 - 'size_units' => ['px', '%'],
392 - 'range' => [
393 - 'px' => [
394 - 'min' => 0,
395 - 'max' => 1000,
396 - 'step' => 1
397 - ],
398 - '%' => [
399 - 'min' => 0,
400 - 'max' => 100
401 - ]
402 - ],
403 - 'default' => [
404 - 'unit' => 'px',
405 - 'size' => 0
406 - ],
407 - 'selectors' => [
408 - '{{WRAPPER}} .betterdocs-toc ul.betterdocs-hierarchial-toc' => 'border-left: {{SIZE}}{{UNIT}} solid #D2D2D2; position:relative;'
409 - ]
410 - ]
411 - );
382 + $this->add_responsive_control(
383 + 'list_border_left_full',
384 + [
385 + 'label' => __( 'Left Border Line', 'betterdocs' ),
386 + 'type' => Controls_Manager::SLIDER,
387 + 'size_units' => [ 'px', '%' ],
388 + 'range' => [
389 + 'px' => [
390 + 'min' => 0,
391 + 'max' => 1000,
392 + 'step' => 1
393 + ],
394 + '%' => [
395 + 'min' => 0,
396 + 'max' => 100
397 + ]
398 + ],
399 + 'default' => [
400 + 'unit' => 'px',
401 + 'size' => 0
402 + ],
403 + 'selectors' => [
404 + '{{WRAPPER}} .betterdocs-toc ul.betterdocs-hierarchial-toc' => 'border-left: {{SIZE}}{{UNIT}} solid #D2D2D2; position:relative;'
405 + ]
406 + ]
407 + );
412 408
413 - $this->add_responsive_control(
414 - 'list_border_left_full_space',
415 - [
416 - 'label' => esc_html__( 'Left Border Line Space', 'betterdocs' ),
417 - 'type' => Controls_Manager::DIMENSIONS,
418 - 'size_units' => ['px', 'em', '%'],
419 - 'default' => [
420 - "top" => '0',
421 - "right" => '0',
422 - "bottom" => '0',
423 - "left" => '0',
424 - "isLinked" => false
425 - ],
426 - 'selectors' => [
427 - '{{WRAPPER}} .betterdocs-toc > .toc-list li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
428 - ]
429 - ]
430 - );
409 + $this->add_responsive_control(
410 + 'list_border_left_full_space',
411 + [
412 + 'label' => esc_html__( 'Left Border Line Space', 'betterdocs' ),
413 + 'type' => Controls_Manager::DIMENSIONS,
414 + 'size_units' => [ 'px', 'em', '%' ],
415 + 'default' => [
416 + 'top' => '0',
417 + 'right' => '0',
418 + 'bottom' => '0',
419 + 'left' => '0',
420 + 'isLinked' => false
421 + ],
422 + 'selectors' => [
423 + '{{WRAPPER}} .betterdocs-toc > .toc-list' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
424 + ]
425 + ]
426 + );
431 427
432 - $this->add_responsive_control(
433 - 'list_border_left_positioning',
434 - [
435 - 'label' => esc_html__( 'Left Border Line Positioning', 'betterdocs' ),
436 - 'type' => Controls_Manager::DIMENSIONS,
437 - 'size_units' => ['px', 'em', '%'],
438 - 'default' => [
439 - "top" => '0',
440 - "right" => '0',
441 - "bottom" => '0',
442 - "left" => '0',
443 - "isLinked" => false
444 - ],
445 - 'selectors' => [
446 - '{{WRAPPER}} .betterdocs-toc ul.betterdocs-hierarchial-toc' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
447 - ]
448 - ]
449 - );
428 + $this->add_responsive_control(
429 + 'list_border_left_positioning',
430 + [
431 + 'label' => esc_html__( 'Left Border Line Positioning', 'betterdocs' ),
432 + 'type' => Controls_Manager::DIMENSIONS,
433 + 'size_units' => [ 'px', 'em', '%' ],
434 + 'default' => [
435 + 'top' => '0',
436 + 'right' => '0',
437 + 'bottom' => '0',
438 + 'left' => '0',
439 + 'isLinked' => false
440 + ],
441 + 'selectors' => [
442 + '{{WRAPPER}} .betterdocs-toc ul.betterdocs-hierarchial-toc' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
443 + ]
444 + ]
445 + );
450 446
451 - $this->add_control(
452 - 'list_border_left_full_color',
453 - [
454 - 'label' => __( 'Left Border Line Color', 'betterdocs' ),
455 - 'type' => Controls_Manager::COLOR,
456 - 'selectors' => [
457 - '{{WRAPPER}} .betterdocs-toc ul.betterdocs-hierarchial-toc' => 'border-color: {{VALUE}};'
458 - ]
459 - ]
460 - );
447 + $this->add_control(
448 + 'list_border_left_full_color',
449 + [
450 + 'label' => __( 'Left Border Line Color', 'betterdocs' ),
451 + 'type' => Controls_Manager::COLOR,
452 + 'selectors' => [
453 + '{{WRAPPER}} .betterdocs-toc ul.betterdocs-hierarchial-toc' => 'border-color: {{VALUE}};'
454 + ]
455 + ]
456 + );
461 457
462 - $this->add_responsive_control(
463 - 'list_border_left',
464 - [
465 - 'label' => __( 'Active List Left Border Width', 'betterodcs' ),
466 - 'type' => Controls_Manager::SLIDER,
467 - 'size_units' => ['px', '%'],
468 - 'range' => [
469 - 'px' => [
470 - 'min' => 0,
471 - 'max' => 1000,
472 - 'step' => 1
473 - ],
474 - '%' => [
475 - 'min' => 0,
476 - 'max' => 100
477 - ]
478 - ],
479 - 'default' => [
480 - 'unit' => 'px',
481 - 'size' => 2
482 - ],
483 - 'selectors' => [
484 - '{{WRAPPER}} .betterdocs-toc ul.betterdocs-hierarchial-toc a.active:after' => 'width: {{SIZE}}{{UNIT}}; content:""; position: absolute; height: 1.6em; left: -1px '
485 - ]
486 - ]
487 - );
458 + $this->add_responsive_control(
459 + 'list_border_left',
460 + [
461 + 'label' => __( 'Active List Left Border Width', 'betterdocs' ),
462 + 'type' => Controls_Manager::SLIDER,
463 + 'size_units' => [ 'px', '%' ],
464 + 'range' => [
465 + 'px' => [
466 + 'min' => 0,
467 + 'max' => 1000,
468 + 'step' => 1
469 + ],
470 + '%' => [
471 + 'min' => 0,
472 + 'max' => 100
473 + ]
474 + ],
475 + 'default' => [
476 + 'unit' => 'px',
477 + 'size' => 2
478 + ],
479 + 'selectors' => [
480 + '{{WRAPPER}} .betterdocs-toc ul.betterdocs-hierarchial-toc a.active:after' => 'width: {{SIZE}}{{UNIT}}; content:""; position: absolute; height: 1.6em; left: -1px '
481 + ]
482 + ]
483 + );
488 484
489 - $this->add_control(
490 - 'list_border_left_color',
491 - [
492 - 'label' => __( 'Active Color Left Border', 'betterdocs' ),
493 - 'type' => Controls_Manager::COLOR,
494 - 'selectors' => [
495 - '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:after' => 'background-color: {{VALUE}};'
496 - ]
497 - ]
498 - );
485 + $this->add_control(
486 + 'list_border_left_color',
487 + [
488 + 'label' => __( 'Active Color Left Border', 'betterdocs' ),
489 + 'type' => Controls_Manager::COLOR,
490 + 'selectors' => [
491 + '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:after' => 'background-color: {{VALUE}};'
492 + ]
493 + ]
494 + );
499 495
500 - $this->add_control(
501 - 'list_color',
502 - [
503 - 'label' => esc_html__( 'List Color', 'betterdocs' ),
504 - 'type' => Controls_Manager::COLOR,
505 - 'selectors' => [
506 - '{{WRAPPER}} .betterdocs-toc ul li a' => 'color: {{VALUE}};',
507 - '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:before' => 'color: {{VALUE}};'
508 - ]
509 - ]
510 - );
496 + // $this->add_responsive_control(
497 + // 'active_border_left_position',
498 + // [
499 + // 'label' => esc_html__( 'Active Left Border Position', 'betterdocs' ),
500 + // 'type' => Controls_Manager::DIMENSIONS,
501 + // 'size_units' => ['px', 'em', '%'],
502 + // 'selectors' => [
503 + // '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:after' => 'left:{{LEFT}}{{UNIT}};',
504 + // '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:after' => 'right:{{RIGHT}}{{UNIT}};',
505 + // '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:after' => 'bottom:{{BOTTOM}}{{UNIT}};',
506 + // '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:after' => 'top:{{TOP}}{{UNIT}};'
507 + // ]
508 + // ]
509 + // );
511 510
512 - $this->add_control(
513 - 'list_hover_color',
514 - [
515 - 'label' => esc_html__( 'List Hover Color', 'betterdocs' ),
516 - 'type' => Controls_Manager::COLOR,
517 - 'selectors' => [
518 - '{{WRAPPER}} .betterdocs-toc ul li a:hover' => 'color: {{VALUE}};'
519 - ]
520 - ]
521 - );
511 + $this->add_responsive_control(
512 + 'active_border_left_position',
513 + [
514 + 'label' => __( 'Active List Left Border Position Left', 'betterdocs' ),
515 + 'type' => Controls_Manager::SLIDER,
516 + 'size_units' => [ 'px', '%' ],
517 + 'range' => [
518 + 'px' => [
519 + 'min' => -1000,
520 + 'max' => 1000,
521 + 'step' => 1
522 + ],
523 + '%' => [
524 + 'min' => 0,
525 + 'max' => 100
526 + ]
527 + ],
528 + 'default' => [
529 + 'unit' => 'px',
530 + 'size' => 2
531 + ],
532 + 'selectors' => [
533 + '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:after' => 'left:{{SIZE}}{{UNIT}}!important;',
534 + ]
535 + ]
536 + );
522 537
523 - $this->add_responsive_control(
524 - 'list_margin',
525 - [
526 - 'label' => esc_html__( 'List Item Spacing', 'betterdocs' ),
527 - 'type' => Controls_Manager::DIMENSIONS,
528 - 'size_units' => ['px', 'em', '%'],
529 - 'selectors' => [
530 - '{{WRAPPER}} .betterdocs-toc ul li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
531 - ]
532 - ]
533 - );
538 + $this->add_responsive_control(
539 + 'active_border_right_position',
540 + [
541 + 'label' => __( 'Active List Left Border Position Right', 'betterdocs' ),
542 + 'type' => Controls_Manager::SLIDER,
543 + 'size_units' => [ 'px', '%' ],
544 + 'range' => [
545 + 'px' => [
546 + 'min' => -1000,
547 + 'max' => 1000,
548 + 'step' => 1
549 + ],
550 + '%' => [
551 + 'min' => 0,
552 + 'max' => 100
553 + ]
554 + ],
555 + 'default' => [
556 + 'unit' => 'px',
557 + 'size' => 2
558 + ],
559 + 'selectors' => [
560 + '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:after' => 'right:{{SIZE}}{{UNIT}}!important;',
561 + ]
562 + ]
563 + );
534 564
535 - $this->add_responsive_control(
536 - 'list_padding',
537 - [
538 - 'label' => esc_html__( 'List Item Padding', 'betterdocs' ),
539 - 'type' => Controls_Manager::DIMENSIONS,
540 - 'size_units' => ['px', 'em', '%'],
541 - 'selectors' => [
542 - '{{WRAPPER}} .betterdocs-toc ul' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; display: inline-block;'
543 - ]
544 - ]
545 - );
565 + $this->add_responsive_control(
566 + 'active_border_bottom_position',
567 + [
568 + 'label' => __( 'Active List Left Border Position Bottom', 'betterdocs' ),
569 + 'type' => Controls_Manager::SLIDER,
570 + 'size_units' => [ 'px', '%' ],
571 + 'range' => [
572 + 'px' => [
573 + 'min' => -1000,
574 + 'max' => 1000,
575 + 'step' => 1
576 + ],
577 + '%' => [
578 + 'min' => 0,
579 + 'max' => 100
580 + ]
581 + ],
582 + 'default' => [
583 + 'unit' => 'px',
584 + 'size' => 2
585 + ],
586 + 'selectors' => [
587 + '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:after' => 'bottom:{{SIZE}}{{UNIT}}!important;',
588 + ]
589 + ]
590 + );
546 591
547 - $this->end_controls_section(); # end of 'Column Settings'
548 - }
592 + $this->add_responsive_control(
593 + 'active_border_top_position',
594 + [
595 + 'label' => __( 'Active List Left Border Position Top', 'betterdocs' ),
596 + 'type' => Controls_Manager::SLIDER,
597 + 'size_units' => [ 'px', '%' ],
598 + 'range' => [
599 + 'px' => [
600 + 'min' => -1000,
601 + 'max' => 1000,
602 + 'step' => 1
603 + ],
604 + '%' => [
605 + 'min' => 0,
606 + 'max' => 100
607 + ]
608 + ],
609 + 'default' => [
610 + 'unit' => 'px',
611 + 'size' => 2
612 + ],
613 + 'selectors' => [
614 + '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:after' => 'top:{{SIZE}}{{UNIT}}!important;',
615 + ]
616 + ]
617 + );
549 618
550 - public function render_callback() {
551 - $this->views( 'widgets/toc' );
552 - }
619 + $this->add_responsive_control(
620 + 'active_border_left_border_radius',
621 + [
622 + 'label' => __( 'Active List Left Border Radius', 'betterdocs' ),
623 + 'type' => Controls_Manager::SLIDER,
624 + 'size_units' => [ 'px', '%' ],
625 + 'range' => [
626 + 'px' => [
627 + 'min' => 0,
628 + 'max' => 1000,
629 + 'step' => 1
630 + ],
631 + '%' => [
632 + 'min' => 0,
633 + 'max' => 100
634 + ]
635 + ],
636 + 'default' => [
637 + 'unit' => 'px',
638 + 'size' => 4
639 + ],
640 + 'selectors' => [
641 + '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:after' => 'border-radius:{{SIZE}}{{UNIT}}!important;',
642 + ]
643 + ]
644 + );
553 645
554 - public function view_params() {
555 - $toc_setting = [
556 - 'htags' => $this->attributes['htags'],
557 - 'hierarchy' => $this->attributes['list_hierarchy'],
558 - 'list_number' => $this->attributes['list_number']
559 - ];
646 + $this->add_control(
647 + 'list_color',
648 + [
649 + 'label' => esc_html__( 'List Color', 'betterdocs' ),
650 + 'type' => Controls_Manager::COLOR,
651 + 'selectors' => [
652 + '{{WRAPPER}} .betterdocs-toc ul li a' => 'color: {{VALUE}};',
653 + '{{WRAPPER}} .betterdocs-toc > .toc-list a.active:before' => 'color: {{VALUE}};'
654 + ]
655 + ]
656 + );
560 657
561 - if ( ElementorPlugin::$instance->editor->is_edit_mode() ) {
562 - set_transient( 'betterdocs_toc_setting', $toc_setting );
563 - }
658 + $this->add_control(
659 + 'list_hover_color',
660 + [
661 + 'label' => esc_html__( 'List Hover Color', 'betterdocs' ),
662 + 'type' => Controls_Manager::COLOR,
663 + 'selectors' => [
664 + '{{WRAPPER}} .betterdocs-toc ul li a:hover' => 'color: {{VALUE}};'
665 + ]
666 + ]
667 + );
564 668
565 - $htags = implode( ',', $this->attributes['htags'] );
669 + $this->add_control(
670 + 'list_hover_bg_color',
671 + [
672 + 'label' => esc_html__( 'List Hover Background Color', 'betterdocs' ),
673 + 'type' => Controls_Manager::COLOR,
674 + 'selectors' => [
675 + '{{WRAPPER}} .betterdocs-toc ul li a:hover' => 'background-color: {{VALUE}};'
676 + ]
677 + ]
678 + );
566 679
567 - $attributes = betterdocs()->template_helper->get_html_attributes( [
568 - 'htags' => $htags,
569 - 'hierarchy' => $this->attributes['list_hierarchy'],
570 - 'list_number' => $this->attributes['list_number'],
571 - 'collapsible_on_mobile' => $this->attributes['collapsible_toc_mobile'],
572 - 'toc_title' => $this->attributes['toc_title']
573 - ] );
680 + $this->add_responsive_control(
681 + 'list_margin',
682 + [
683 + 'label' => esc_html__( 'List Item Spacing', 'betterdocs' ),
684 + 'type' => Controls_Manager::DIMENSIONS,
685 + 'size_units' => [ 'px', 'em', '%' ],
686 + 'selectors' => [
687 + '{{WRAPPER}} .betterdocs-toc ul li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
688 + ]
689 + ]
690 + );
574 691
575 - return [
576 - 'attributes' => $attributes
577 - ];
578 - }
692 + $this->add_responsive_control(
693 + 'list_padding',
694 + [
695 + 'label' => esc_html__( 'List Wrapper Padding', 'betterdocs' ),
696 + 'type' => Controls_Manager::DIMENSIONS,
697 + 'size_units' => [ 'px', 'em', '%' ],
698 + 'selectors' => [
699 + '{{WRAPPER}} .betterdocs-toc ul' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; display: inline-block;'
700 + ]
701 + ]
702 + );
703 +
704 + $this->add_responsive_control(
705 + 'list_item_padding',
706 + [
707 + 'label' => esc_html__( 'List Item Padding', 'betterdocs' ),
708 + 'type' => Controls_Manager::DIMENSIONS,
709 + 'size_units' => [ 'px', 'em', '%' ],
710 + 'selectors' => [
711 + '{{WRAPPER}} .betterdocs-toc ul li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; display: inline-block;'
712 + ]
713 + ]
714 + );
715 +
716 + $this->end_controls_section(); # end of 'Column Settings'
717 + }
718 +
719 + public function render_callback() {
720 + $this->views( 'widgets/toc' );
721 + }
722 +
723 + public function view_params() {
724 + $toc_setting = [
725 + 'htags' => $this->attributes['htags'],
726 + 'hierarchy' => $this->attributes['list_hierarchy'],
727 + 'list_number' => $this->attributes['list_number']
728 + ];
729 +
730 + set_transient( 'betterdocs_toc_setting', $toc_setting );
731 +
732 + $htags = implode( ',', $this->attributes['htags'] );
733 +
734 + $attributes = betterdocs()->template_helper->get_html_attributes(
735 + [
736 + 'htags' => $htags,
737 + 'hierarchy' => $this->attributes['list_hierarchy'],
738 + 'list_number' => $this->attributes['list_number'],
739 + 'collapsible_on_mobile' => $this->attributes['collapsible_toc_mobile'],
740 + 'toc_title' => $this->attributes['toc_title']
741 + ]
742 + );
743 +
744 + return [
745 + 'attributes' => $attributes
746 + ];
747 + }
579 748 }