Custom_JS.php
1 year ago
Hover_Effect.php
1 year ago
Image_Masking.php
2 months ago
Liquid_Glass_Effect.php
5 months ago
Post_Duplicator.php
2 months ago
Promotion.php
9 months ago
Reading_Progress.php
5 months ago
Scroll_to_Top.php
5 months ago
Table_of_Content.php
2 weeks ago
Vertical_Text_Orientation.php
7 months ago
Wrapper_Link.php
2 months ago
index.php
3 years ago
Table_of_Content.php
1367 lines
| 1 | <?php |
| 2 | namespace Essential_Addons_Elementor\Extensions; |
| 3 | |
| 4 | if (!defined('ABSPATH')) { |
| 5 | exit; |
| 6 | } |
| 7 | |
| 8 | use \Elementor\Controls_Manager; |
| 9 | use \Elementor\Group_Control_Border; |
| 10 | use \Elementor\Group_Control_Box_Shadow; |
| 11 | use \Elementor\Group_Control_Typography; |
| 12 | use \Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 13 | use \Essential_Addons_Elementor\Classes\Helper; |
| 14 | |
| 15 | class Table_of_Content |
| 16 | { |
| 17 | |
| 18 | public function __construct() |
| 19 | { |
| 20 | add_action('elementor/documents/register_controls', [$this, 'register_controls'], 10); |
| 21 | } |
| 22 | |
| 23 | public function register_controls($element) |
| 24 | { |
| 25 | if (Helper::prevent_extension_loading(get_the_ID())) { |
| 26 | return; |
| 27 | } |
| 28 | |
| 29 | $global_settings = get_option('eael_global_settings'); |
| 30 | |
| 31 | $element->start_controls_section( |
| 32 | 'eael_ext_table_of_content_section', |
| 33 | [ |
| 34 | 'label' => __('<i class="eaicon-logo"></i> Table of Contents', 'essential-addons-for-elementor-lite'), |
| 35 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 36 | ] |
| 37 | ); |
| 38 | |
| 39 | $element->add_control( |
| 40 | 'eael_ext_table_of_content', |
| 41 | [ |
| 42 | 'label' => __('Enable Table of Contents', 'essential-addons-for-elementor-lite'), |
| 43 | 'type' => Controls_Manager::SWITCHER, |
| 44 | 'default' => 'no', |
| 45 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 46 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 47 | 'return_value' => 'yes', |
| 48 | ] |
| 49 | ); |
| 50 | |
| 51 | $element->add_control( |
| 52 | 'eael_ext_toc_has_global', |
| 53 | [ |
| 54 | 'type' => Controls_Manager::HIDDEN, |
| 55 | 'default' => isset($global_settings['eael_ext_table_of_content']['enabled']) ? true : false, |
| 56 | ] |
| 57 | ); |
| 58 | |
| 59 | if (isset($global_settings['eael_ext_table_of_content']['enabled']) && ($global_settings['eael_ext_table_of_content']['enabled'] == true) && get_the_ID() != $global_settings['eael_ext_table_of_content']['post_id'] && get_post_status($global_settings['eael_ext_table_of_content']['post_id']) == 'publish') { |
| 60 | $element->add_control( |
| 61 | 'eael_ext_toc_global_warning_text', |
| 62 | [ |
| 63 | 'type' => Controls_Manager::RAW_HTML, |
| 64 | 'raw' => sprintf( |
| 65 | /* translators: %s: Edit link to the Global Table of Contents settings. */ |
| 66 | __('You can modify the Global Table of Contents by <strong><a href="%s">Clicking Here</a></strong>', 'essential-addons-for-elementor-lite'), |
| 67 | esc_url( get_bloginfo('url') . '/wp-admin/post.php?post=' . $global_settings['eael_ext_table_of_content']['post_id'] . '&action=elementor' ) |
| 68 | ), |
| 69 | 'content_classes' => 'eael-warning', |
| 70 | 'condition' => [ |
| 71 | 'eael_ext_table_of_content' => 'yes', |
| 72 | ], |
| 73 | ] |
| 74 | ); |
| 75 | } else { |
| 76 | $element->add_control( |
| 77 | 'eael_ext_toc_global', |
| 78 | [ |
| 79 | 'label' => __( 'Enable Table of Contents Globally', 'essential-addons-for-elementor-lite' ), |
| 80 | 'description' => __( 'Enabling this option will effect on entire site.', 'essential-addons-for-elementor-lite' ), |
| 81 | 'type' => Controls_Manager::SWITCHER, |
| 82 | 'default' => 'no', |
| 83 | 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ), |
| 84 | 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ), |
| 85 | 'return_value' => 'yes', |
| 86 | 'condition' => [ |
| 87 | 'eael_ext_table_of_content' => 'yes', |
| 88 | ], |
| 89 | ] |
| 90 | ); |
| 91 | $supported_posts = get_option( 'elementor_cpt_support' ); |
| 92 | $display_on = [ |
| 93 | 'all' => __( 'All', 'essential-addons-for-elementor-lite' ), |
| 94 | 'post' => __( 'All Posts', 'essential-addons-for-elementor-lite' ), |
| 95 | 'page' => __( 'All Pages', 'essential-addons-for-elementor-lite' ), |
| 96 | ]; |
| 97 | |
| 98 | if ( ! empty( $supported_posts ) ) { |
| 99 | foreach ( $supported_posts as $post_type ) { |
| 100 | $post_obj = get_post_type_object( $post_type ); |
| 101 | |
| 102 | if ( ! in_array( $post_type, [ 'post', 'page' ] ) && is_a( $post_obj, 'WP_Post_Type' ) && $post_obj->labels ) { |
| 103 | $plural_name = ! empty( $post_obj->labels->name ) ? $post_obj->labels->name : ''; |
| 104 | |
| 105 | // Translators: %s: Post type name. |
| 106 | $display_on[ $post_type ] = sprintf( __( 'All %s', 'essential-addons-for-elementor-lite' ), $plural_name ); |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | $element->add_control( |
| 112 | 'eael_ext_toc_global_display_condition', |
| 113 | [ |
| 114 | 'label' => __('Display On', 'essential-addons-for-elementor-lite'), |
| 115 | 'type' => Controls_Manager::SELECT, |
| 116 | 'default' => 'all', |
| 117 | 'options' => $display_on, |
| 118 | 'condition' => [ |
| 119 | 'eael_ext_table_of_content' => 'yes', |
| 120 | 'eael_ext_toc_global' => 'yes', |
| 121 | ], |
| 122 | ] |
| 123 | ); |
| 124 | } |
| 125 | |
| 126 | $element->add_control( |
| 127 | 'eael_ext_toc_title', |
| 128 | [ |
| 129 | 'label' => __('Title', 'essential-addons-for-elementor-lite'), |
| 130 | 'type' => Controls_Manager::TEXT, |
| 131 | 'dynamic' => [ 'active' => true ], |
| 132 | 'default' => __('Table of Contents', 'essential-addons-for-elementor-lite'), |
| 133 | 'label_block' => false, |
| 134 | 'condition' => [ |
| 135 | 'eael_ext_table_of_content' => 'yes', |
| 136 | ], |
| 137 | 'ai' => [ |
| 138 | 'active' => true, |
| 139 | ], |
| 140 | ] |
| 141 | ); |
| 142 | |
| 143 | $element->add_control( |
| 144 | 'eael_ext_toc_title_tag', |
| 145 | [ |
| 146 | 'label' => esc_html__( 'HTML Tag', 'essential-addons-for-elementor-lite' ), |
| 147 | 'type' => Controls_Manager::CHOOSE, |
| 148 | 'options' => [ |
| 149 | 'h1' => [ |
| 150 | 'title' => esc_html__( 'H1', 'essential-addons-for-elementor-lite' ), |
| 151 | 'icon' => 'eicon-editor-h1', |
| 152 | ], |
| 153 | 'h2' => [ |
| 154 | 'title' => esc_html__( 'H2', 'essential-addons-for-elementor-lite' ), |
| 155 | 'icon' => 'eicon-editor-h2', |
| 156 | ], |
| 157 | 'h3' => [ |
| 158 | 'title' => esc_html__( 'H3', 'essential-addons-for-elementor-lite' ), |
| 159 | 'icon' => 'eicon-editor-h3', |
| 160 | ], |
| 161 | 'h4' => [ |
| 162 | 'title' => esc_html__( 'H4', 'essential-addons-for-elementor-lite' ), |
| 163 | 'icon' => 'eicon-editor-h4', |
| 164 | ], |
| 165 | 'h5' => [ |
| 166 | 'title' => esc_html__( 'H5', 'essential-addons-for-elementor-lite' ), |
| 167 | 'icon' => 'eicon-editor-h5', |
| 168 | ], |
| 169 | 'h6' => [ |
| 170 | 'title' => esc_html__( 'H6', 'essential-addons-for-elementor-lite' ), |
| 171 | 'icon' => 'eicon-editor-h6', |
| 172 | ], |
| 173 | ], |
| 174 | 'condition' => [ |
| 175 | 'eael_ext_table_of_content' => 'yes', |
| 176 | ], |
| 177 | 'default' => 'h2', |
| 178 | ] |
| 179 | ); |
| 180 | |
| 181 | $element->start_controls_tabs('eael_toc_include_exclude', ['separator' => 'before']); |
| 182 | |
| 183 | $element->start_controls_tab('eael_toc_include', |
| 184 | [ |
| 185 | 'label' => __('Include', 'essential-addons-for-elementor-lite'), |
| 186 | 'condition' => [ |
| 187 | 'eael_ext_table_of_content' => 'yes', |
| 188 | ], |
| 189 | ] |
| 190 | ); |
| 191 | |
| 192 | $element->add_control( |
| 193 | 'eael_ext_toc_supported_heading_tag', |
| 194 | [ |
| 195 | 'label' => __('Supported Heading Tag', 'essential-addons-for-elementor-lite'), |
| 196 | 'type' => Controls_Manager::SELECT2, |
| 197 | 'multiple' => true, |
| 198 | 'label_block' => true, |
| 199 | 'default' => [ |
| 200 | 'h2', |
| 201 | 'h3', |
| 202 | 'h4', |
| 203 | 'h5', |
| 204 | 'h6', |
| 205 | ], |
| 206 | 'options' => [ |
| 207 | 'h1' => __('H1', 'essential-addons-for-elementor-lite'), |
| 208 | 'h2' => __('H2', 'essential-addons-for-elementor-lite'), |
| 209 | 'h3' => __('H3', 'essential-addons-for-elementor-lite'), |
| 210 | 'h4' => __('H4', 'essential-addons-for-elementor-lite'), |
| 211 | 'h5' => __('H5', 'essential-addons-for-elementor-lite'), |
| 212 | 'h6' => __('H6', 'essential-addons-for-elementor-lite'), |
| 213 | ], |
| 214 | 'render_type' => 'none', |
| 215 | 'condition' => [ |
| 216 | 'eael_ext_table_of_content' => 'yes', |
| 217 | ], |
| 218 | ] |
| 219 | ); |
| 220 | |
| 221 | $element->add_control( |
| 222 | 'eael_ext_toc_content_selector', |
| 223 | [ |
| 224 | 'label' => __('Content Selector', 'essential-addons-for-elementor-lite'), |
| 225 | 'type' => Controls_Manager::TEXT, |
| 226 | 'dynamic' => [ 'active' => true ], |
| 227 | 'description' => __('Which content are searched for heading tag, Provide unique selector to replace default selector', 'essential-addons-for-elementor-lite'), |
| 228 | 'label_block' => false, |
| 229 | 'condition' => [ |
| 230 | 'eael_ext_table_of_content' => 'yes', |
| 231 | ], |
| 232 | 'ai' => [ |
| 233 | 'active' => true, |
| 234 | ], |
| 235 | ] |
| 236 | ); |
| 237 | |
| 238 | $element->end_controls_tab(); // include |
| 239 | |
| 240 | $element->start_controls_tab('eael_toc_exclude', |
| 241 | [ |
| 242 | 'label' => __('Exclude', 'essential-addons-for-elementor-lite'), |
| 243 | 'condition' => [ |
| 244 | 'eael_ext_table_of_content' => 'yes', |
| 245 | ], |
| 246 | ] |
| 247 | ); |
| 248 | |
| 249 | $element->add_control( |
| 250 | 'eael_toc_exclude_selector', |
| 251 | [ |
| 252 | 'label' => __('Exclude By Selector', 'essential-addons-for-elementor-lite'), |
| 253 | 'type' => Controls_Manager::TEXT, |
| 254 | 'dynamic' => [ 'active' => true ], |
| 255 | 'description' => __('CSS selectors, in a comma-separated list', 'essential-addons-for-elementor-lite'), |
| 256 | 'default' => '', |
| 257 | 'label_block' => true, |
| 258 | 'condition' => [ |
| 259 | 'eael_ext_table_of_content' => 'yes', |
| 260 | ], |
| 261 | 'ai' => [ |
| 262 | 'active' => true, |
| 263 | ], |
| 264 | ] |
| 265 | ); |
| 266 | |
| 267 | $element->end_controls_tab(); // exclude |
| 268 | |
| 269 | $element->end_controls_tabs(); // include_exclude_tags |
| 270 | |
| 271 | $element->add_control( |
| 272 | 'eael_ext_toc_collapse_sub_heading', |
| 273 | [ |
| 274 | 'label' => __('Keep Sub Heading Collapsed', 'essential-addons-for-elementor-lite'), |
| 275 | 'type' => Controls_Manager::SWITCHER, |
| 276 | 'default' => 'yes', |
| 277 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 278 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 279 | 'return_value' => 'yes', |
| 280 | 'condition' => [ |
| 281 | 'eael_ext_table_of_content' => 'yes', |
| 282 | ], |
| 283 | ] |
| 284 | ); |
| 285 | |
| 286 | $element->add_control( |
| 287 | 'eael_ext_toc_use_title_in_url', |
| 288 | [ |
| 289 | 'label' => __('Heading Text in URL', 'essential-addons-for-elementor-lite'), |
| 290 | 'type' => Controls_Manager::SWITCHER, |
| 291 | 'default' => 'no', |
| 292 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 293 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 294 | 'return_value' => 'yes', |
| 295 | 'condition' => [ |
| 296 | 'eael_ext_table_of_content' => 'yes', |
| 297 | ], |
| 298 | ] |
| 299 | ); |
| 300 | |
| 301 | $element->add_control( |
| 302 | 'eael_ext_toc_word_wrap', |
| 303 | [ |
| 304 | 'label' => __('Stop Word Wrap', 'essential-addons-for-elementor-lite'), |
| 305 | 'type' => Controls_Manager::SWITCHER, |
| 306 | 'default' => 'no', |
| 307 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 308 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 309 | 'return_value' => 'yes', |
| 310 | 'condition' => [ |
| 311 | 'eael_ext_table_of_content' => 'yes', |
| 312 | ], |
| 313 | ] |
| 314 | ); |
| 315 | |
| 316 | $element->add_control( |
| 317 | 'eael_ext_toc_word_wrap_max_width', |
| 318 | [ |
| 319 | 'label' => __('Max Line Width', 'essential-addons-for-elementor-lite'), |
| 320 | 'type' => Controls_Manager::SLIDER, |
| 321 | 'size_units' => ['px', '%'], |
| 322 | 'range' => [ |
| 323 | 'px' => ['min' => 100, 'max' => 1000, 'step' => 10], |
| 324 | '%' => ['min' => 10, 'max' => 100], |
| 325 | ], |
| 326 | 'default' => ['unit' => 'px', 'size' => 260], |
| 327 | 'selectors' => [ |
| 328 | '{{WRAPPER}} .eael-toc .eael-toc-body ul.eael-toc-list.eael-toc-word-wrap li a span' => 'max-width: {{SIZE}}{{UNIT}};', |
| 329 | ], |
| 330 | 'condition' => [ |
| 331 | 'eael_ext_table_of_content' => 'yes', |
| 332 | 'eael_ext_toc_word_wrap' => 'yes', |
| 333 | ], |
| 334 | ] |
| 335 | ); |
| 336 | |
| 337 | $element->add_control( |
| 338 | 'eael_ext_toc_auto_collapse', |
| 339 | [ |
| 340 | 'label' => __('TOC Auto Collapse', 'essential-addons-for-elementor-lite'), |
| 341 | 'type' => Controls_Manager::SWITCHER, |
| 342 | 'default' => 'yes', |
| 343 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 344 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 345 | 'return_value' => 'yes', |
| 346 | 'condition' => [ |
| 347 | 'eael_ext_table_of_content' => 'yes', |
| 348 | ], |
| 349 | ] |
| 350 | ); |
| 351 | |
| 352 | $element->add_control( |
| 353 | 'eael_ext_toc_auto_highlight', |
| 354 | [ |
| 355 | 'label' => __('TOC Auto Highlight', 'essential-addons-for-elementor-lite'), |
| 356 | 'type' => Controls_Manager::SWITCHER, |
| 357 | 'default' => 'no', |
| 358 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 359 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 360 | 'return_value' => 'yes', |
| 361 | 'condition' => [ |
| 362 | 'eael_ext_table_of_content' => 'yes', |
| 363 | ], |
| 364 | ] |
| 365 | ); |
| 366 | |
| 367 | $element->add_control( |
| 368 | 'eael_ext_toc_auto_highlight_single_item_only', |
| 369 | [ |
| 370 | 'label' => __('Single or All Visible Headings?', 'essential-addons-for-elementor-lite'), |
| 371 | 'type' => Controls_Manager::SWITCHER, |
| 372 | 'default' => 'yes', |
| 373 | 'label_on' => __('Single', 'essential-addons-for-elementor-lite'), |
| 374 | 'label_off' => __('All', 'essential-addons-for-elementor-lite'), |
| 375 | 'return_value' => 'yes', |
| 376 | 'description' => __('If you select "Single", only the first visible heading will be highlighted. If you select "All", all visible headings will be highlighted.', 'essential-addons-for-elementor-lite'), |
| 377 | 'condition' => [ |
| 378 | 'eael_ext_table_of_content' => 'yes', |
| 379 | 'eael_ext_toc_auto_highlight' => 'yes', |
| 380 | ], |
| 381 | ] |
| 382 | ); |
| 383 | |
| 384 | $element->add_control( |
| 385 | 'eael_ext_toc_auto_highlight_color', |
| 386 | [ |
| 387 | 'label' => __('Highlight Color', 'essential-addons-for-elementor-lite'), |
| 388 | 'type' => Controls_Manager::COLOR, |
| 389 | 'default' => '#ff7d50', |
| 390 | 'selectors' => [ |
| 391 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list .eael-toc-link.eael-highlight-active' => 'color: {{VALUE}};', |
| 392 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-bullet li:has(.eael-toc-link.eael-highlight-active):before' => 'background-color: {{VALUE}};', |
| 393 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-number li:has(.eael-toc-link.eael-highlight-active):before' => 'color: {{VALUE}};', |
| 394 | ], |
| 395 | 'condition' => [ |
| 396 | 'eael_ext_table_of_content' => 'yes', |
| 397 | 'eael_ext_toc_auto_highlight' => 'yes', |
| 398 | ], |
| 399 | ] |
| 400 | ); |
| 401 | |
| 402 | $element->add_control( |
| 403 | 'eael_ext_toc_scroll_sync', |
| 404 | [ |
| 405 | 'label' => __('TOC Scroll Sync', 'essential-addons-for-elementor-lite'), |
| 406 | 'description' => __('Automatically scroll the TOC list to keep the active heading visible.', 'essential-addons-for-elementor-lite'), |
| 407 | 'type' => Controls_Manager::SWITCHER, |
| 408 | 'default' => 'no', |
| 409 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 410 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 411 | 'return_value' => 'yes', |
| 412 | 'condition' => [ |
| 413 | 'eael_ext_table_of_content' => 'yes', |
| 414 | 'eael_ext_toc_auto_highlight' => 'yes', |
| 415 | ], |
| 416 | ] |
| 417 | ); |
| 418 | |
| 419 | $element->add_control( |
| 420 | 'eael_ext_toc_hide_in_mobile', |
| 421 | [ |
| 422 | 'label' => __('Hide TOC in mobile', 'essential-addons-for-elementor-lite'), |
| 423 | 'type' => Controls_Manager::SWITCHER, |
| 424 | 'default' => 'no', |
| 425 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 426 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 427 | 'return_value' => 'yes', |
| 428 | 'condition' => [ |
| 429 | 'eael_ext_table_of_content' => 'yes', |
| 430 | ], |
| 431 | ] |
| 432 | ); |
| 433 | |
| 434 | $element->add_responsive_control( |
| 435 | 'eael_ext_toc_max_height', |
| 436 | [ |
| 437 | 'label' => __( 'Height', 'essential-addons-for-elementor-lite' ), |
| 438 | 'type' => Controls_Manager::SLIDER, |
| 439 | 'range' => [ |
| 440 | 'vh' => [ |
| 441 | 'min' => 10, |
| 442 | 'max' => 100, |
| 443 | ], |
| 444 | ], |
| 445 | 'default' => [ |
| 446 | 'size' => 50, |
| 447 | ], |
| 448 | 'size_units' => [ 'vh' ], |
| 449 | 'selectors' => [ |
| 450 | '{{WRAPPER}} .eael-toc.eael-sticky .eael-toc-body' => 'max-height: {{SIZE}}vh; height: {{SIZE}}vh;', |
| 451 | ], |
| 452 | 'condition' => [ |
| 453 | 'eael_ext_table_of_content' => 'yes', |
| 454 | ], |
| 455 | ] |
| 456 | ); |
| 457 | |
| 458 | $element->add_control( |
| 459 | 'eael_ext_toc_sticky_scroll', |
| 460 | [ |
| 461 | 'label' => __('Sticky Scroll Effect', 'essential-addons-for-elementor-lite'), |
| 462 | 'type' => Controls_Manager::SLIDER, |
| 463 | 'size_units' => ['px'], |
| 464 | 'range' => [ |
| 465 | 'px' => [ |
| 466 | 'min' => 5, |
| 467 | 'max' => 2000, |
| 468 | 'step' => 10, |
| 469 | ], |
| 470 | ], |
| 471 | 'default' => [ |
| 472 | 'unit' => 'px', |
| 473 | 'size' => 200, |
| 474 | ], |
| 475 | 'condition' => [ |
| 476 | 'eael_ext_table_of_content' => 'yes', |
| 477 | ], |
| 478 | ] |
| 479 | ); |
| 480 | |
| 481 | $element->add_control( |
| 482 | 'eael_ext_toc_sticky_offset', |
| 483 | [ |
| 484 | 'label' => __('Sticky Top Offset', 'essential-addons-for-elementor-lite'), |
| 485 | 'type' => Controls_Manager::SLIDER, |
| 486 | 'size_units' => ['px'], |
| 487 | 'range' => [ |
| 488 | 'px' => [ |
| 489 | 'min' => 5, |
| 490 | 'max' => 2000, |
| 491 | 'step' => 10, |
| 492 | ], |
| 493 | ], |
| 494 | 'default' => [ |
| 495 | 'unit' => 'px', |
| 496 | 'size' => 200, |
| 497 | ], |
| 498 | 'selectors' => [ |
| 499 | '{{WRAPPER}} .eael-toc.eael-sticky' => 'top: {{SIZE}}{{UNIT}} !important;', |
| 500 | ], |
| 501 | 'condition' => [ |
| 502 | 'eael_ext_table_of_content' => 'yes', |
| 503 | ], |
| 504 | ] |
| 505 | ); |
| 506 | |
| 507 | $element->add_control( |
| 508 | 'eael_ext_toc_main_page_offset', |
| 509 | [ |
| 510 | 'label' => __('Main Page Offset', 'essential-addons-for-elementor-lite'), |
| 511 | 'type' => Controls_Manager::SLIDER, |
| 512 | 'size_units' => ['px'], |
| 513 | 'range' => [ |
| 514 | 'px' => [ |
| 515 | 'min' => 5, |
| 516 | 'max' => 2000, |
| 517 | 'step' => 10, |
| 518 | ], |
| 519 | ], |
| 520 | 'default' => [ |
| 521 | 'unit' => 'px', |
| 522 | 'size' => 120, |
| 523 | ], |
| 524 | 'condition' => [ |
| 525 | 'eael_ext_table_of_content' => 'yes', |
| 526 | ], |
| 527 | ] |
| 528 | ); |
| 529 | |
| 530 | $element->add_control( |
| 531 | 'eael_ext_toc_sticky_z_index', |
| 532 | [ |
| 533 | 'label' => __('Z Index', 'essential-addons-for-elementor-lite'), |
| 534 | 'type' => Controls_Manager::SLIDER, |
| 535 | 'size_units' => ['px'], |
| 536 | 'range' => [ |
| 537 | 'px' => [ |
| 538 | 'min' => 0, |
| 539 | 'max' => 9999, |
| 540 | 'step' => 10, |
| 541 | ], |
| 542 | ], |
| 543 | 'default' => [ |
| 544 | 'unit' => 'px', |
| 545 | 'size' => 9999, |
| 546 | ], |
| 547 | 'selectors' => [ |
| 548 | '{{WRAPPER}} .eael-toc' => 'z-index: {{SIZE}}', |
| 549 | ], |
| 550 | 'condition' => [ |
| 551 | 'eael_ext_table_of_content' => 'yes', |
| 552 | ], |
| 553 | ] |
| 554 | ); |
| 555 | |
| 556 | $element->add_control( |
| 557 | 'eael_ext_toc_ad_warning_text', |
| 558 | [ |
| 559 | 'type' => Controls_Manager::RAW_HTML, |
| 560 | 'raw' => __('Need more information about TOC <strong><a href="https://essential-addons.com/elementor/docs/table-of-content/" class="eael-btn" target="_blank">Visit documentation</a></strong>', 'essential-addons-for-elementor-lite'), |
| 561 | 'content_classes' => 'eael-warning', |
| 562 | 'separator' => 'before', |
| 563 | 'condition' => [ |
| 564 | 'eael_ext_table_of_content' => 'yes', |
| 565 | ], |
| 566 | ] |
| 567 | ); |
| 568 | |
| 569 | $element->end_controls_section(); |
| 570 | |
| 571 | $element->start_controls_section( |
| 572 | 'eael_ext_toc_main', |
| 573 | [ |
| 574 | 'label' => esc_html__('EA TOC', 'essential-addons-for-elementor-lite'), |
| 575 | 'tab' => Controls_Manager::TAB_STYLE, |
| 576 | 'condition' => [ |
| 577 | 'eael_ext_table_of_content' => 'yes', |
| 578 | ], |
| 579 | ] |
| 580 | ); |
| 581 | |
| 582 | $element->add_responsive_control( |
| 583 | 'eael_ext_toc_width', |
| 584 | [ |
| 585 | 'label' => __('Width', 'essential-addons-for-elementor-lite'), |
| 586 | 'type' => Controls_Manager::SLIDER, |
| 587 | 'size_units' => ['px'], |
| 588 | 'range' => [ |
| 589 | 'px' => [ |
| 590 | 'min' => 0, |
| 591 | 'max' => 1000, |
| 592 | 'step' => 1, |
| 593 | ], |
| 594 | ], |
| 595 | 'default' => [ |
| 596 | 'unit' => 'px', |
| 597 | 'size' => 300, |
| 598 | ], |
| 599 | 'selectors' => [ |
| 600 | '{{WRAPPER}} .eael-toc' => 'width: {{SIZE}}{{UNIT}};', |
| 601 | ], |
| 602 | 'condition' => [ |
| 603 | 'eael_ext_table_of_content' => 'yes', |
| 604 | ], |
| 605 | ] |
| 606 | ); |
| 607 | |
| 608 | $element->add_control( |
| 609 | 'eael_ext_toc_position', |
| 610 | [ |
| 611 | 'label' => __('Position', 'essential-addons-for-elementor-lite'), |
| 612 | 'type' => Controls_Manager::SELECT, |
| 613 | 'default' => 'left', |
| 614 | 'label_block' => false, |
| 615 | 'options' => [ |
| 616 | 'left' => __('Left', 'essential-addons-for-elementor-lite'), |
| 617 | 'right' => __('Right', 'essential-addons-for-elementor-lite'), |
| 618 | ], |
| 619 | 'separator' => 'before', |
| 620 | 'condition' => [ |
| 621 | 'eael_ext_table_of_content' => 'yes', |
| 622 | ], |
| 623 | ] |
| 624 | ); |
| 625 | |
| 626 | $element->add_control( |
| 627 | 'eael_ext_toc_position_mobile', |
| 628 | [ |
| 629 | 'label' => esc_html__( 'Position For Mobile Device', 'essential-addons-for-elementor-lite' ), |
| 630 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 631 | 'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ), |
| 632 | 'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 633 | 'return_value' => 'yes', |
| 634 | ] |
| 635 | ); |
| 636 | |
| 637 | $element->add_control( |
| 638 | 'eael_ext_toc_position_mobile_top_bottom', |
| 639 | [ |
| 640 | 'label' => __('Position', 'essential-addons-for-elementor-lite'), |
| 641 | 'type' => Controls_Manager::SELECT, |
| 642 | 'default' => 'top', |
| 643 | 'label_block' => false, |
| 644 | 'options' => [ |
| 645 | 'top' => __('Top', 'essential-addons-for-elementor-lite'), |
| 646 | 'bottom' => __('Bottom', 'essential-addons-for-elementor-lite'), |
| 647 | ], |
| 648 | 'condition' => [ |
| 649 | 'eael_ext_table_of_content' => 'yes', |
| 650 | 'eael_ext_toc_position_mobile' => 'yes', |
| 651 | ], |
| 652 | ] |
| 653 | ); |
| 654 | |
| 655 | $element->add_control( |
| 656 | 'eael_ext_toc_position_mobile_top_offset', |
| 657 | [ |
| 658 | 'label' => __('Top Offset', 'essential-addons-for-elementor-lite'), |
| 659 | 'type' => Controls_Manager::SLIDER, |
| 660 | 'size_units' => ['px'], |
| 661 | 'range' => [ |
| 662 | 'px' => [ |
| 663 | 'min' => 5, |
| 664 | 'max' => 2000, |
| 665 | 'step' => 10, |
| 666 | ], |
| 667 | ], |
| 668 | 'default' => [ |
| 669 | 'unit' => 'px', |
| 670 | 'size' => 50, |
| 671 | ], |
| 672 | 'selectors' => [ |
| 673 | '{{WRAPPER}} .eael-toc.eael-toc-top.eael-sticky' => 'top: {{SIZE}}{{UNIT}} !important;', |
| 674 | ], |
| 675 | 'condition' => [ |
| 676 | 'eael_ext_table_of_content' => 'yes', |
| 677 | 'eael_ext_toc_position_mobile_top_bottom' => 'top', |
| 678 | 'eael_ext_toc_position_mobile' => 'yes', |
| 679 | ], |
| 680 | ] |
| 681 | ); |
| 682 | |
| 683 | $element->add_control( |
| 684 | 'eael_ext_toc_position_mobile_bottom_offset', |
| 685 | [ |
| 686 | 'label' => __('Bottom Offset', 'essential-addons-for-elementor-lite'), |
| 687 | 'type' => Controls_Manager::SLIDER, |
| 688 | 'size_units' => ['px'], |
| 689 | 'range' => [ |
| 690 | 'px' => [ |
| 691 | 'min' => 5, |
| 692 | 'max' => 2000, |
| 693 | 'step' => 10, |
| 694 | ], |
| 695 | ], |
| 696 | 'default' => [ |
| 697 | 'unit' => 'px', |
| 698 | 'size' => 50, |
| 699 | ], |
| 700 | 'selectors' => [ |
| 701 | '{{WRAPPER}} .eael-toc.eael-toc-bottom.eael-sticky' => 'bottom: {{SIZE}}{{UNIT}};', |
| 702 | ], |
| 703 | 'condition' => [ |
| 704 | 'eael_ext_table_of_content' => 'yes', |
| 705 | 'eael_ext_toc_position_mobile_top_bottom' => 'bottom', |
| 706 | 'eael_ext_toc_position_mobile' => 'yes', |
| 707 | ], |
| 708 | ] |
| 709 | ); |
| 710 | |
| 711 | $element->add_control( |
| 712 | 'eael_ext_toc_list_icon', |
| 713 | [ |
| 714 | 'label' => __('List Icon', 'essential-addons-for-elementor-lite'), |
| 715 | 'type' => Controls_Manager::SELECT, |
| 716 | 'default' => 'bullet', |
| 717 | 'label_block' => false, |
| 718 | 'options' => [ |
| 719 | 'bullet' => __('Bullet', 'essential-addons-for-elementor-lite'), |
| 720 | 'number' => __('Number', 'essential-addons-for-elementor-lite'), |
| 721 | ], |
| 722 | 'condition' => [ |
| 723 | 'eael_ext_table_of_content' => 'yes', |
| 724 | ], |
| 725 | ] |
| 726 | ); |
| 727 | |
| 728 | $element->add_control( |
| 729 | 'eael_ext_toc_box_list_bullet_size', |
| 730 | [ |
| 731 | 'label' => __('Bullet Size', 'essential-addons-for-elementor-lite'), |
| 732 | 'type' => Controls_Manager::SLIDER, |
| 733 | 'size_units' => ['px'], |
| 734 | 'range' => [ |
| 735 | 'px' => [ |
| 736 | 'min' => 0, |
| 737 | 'max' => 50, |
| 738 | 'step' => 1, |
| 739 | ], |
| 740 | ], |
| 741 | 'default' => [ |
| 742 | 'unit' => 'px', |
| 743 | 'size' => 8, |
| 744 | ], |
| 745 | 'selectors' => [ |
| 746 | '{{WRAPPER}} .eael-toc .eael-toc-body ul.eael-toc-list.eael-toc-bullet li:before' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 747 | ], |
| 748 | 'condition' => [ |
| 749 | 'eael_ext_toc_list_icon' => 'bullet', |
| 750 | ], |
| 751 | ] |
| 752 | ); |
| 753 | |
| 754 | $element->add_control( |
| 755 | 'eael_ext_toc_box_list_top_position', |
| 756 | [ |
| 757 | 'label' => __('Top Position', 'essential-addons-for-elementor-lite'), |
| 758 | 'type' => Controls_Manager::SLIDER, |
| 759 | 'size_units' => ['px'], |
| 760 | 'range' => [ |
| 761 | 'px' => [ |
| 762 | 'min' => -50, |
| 763 | 'max' => 50, |
| 764 | 'step' => 1, |
| 765 | ], |
| 766 | ], |
| 767 | 'default' => [ |
| 768 | 'unit' => 'px', |
| 769 | 'size' => -2, |
| 770 | ], |
| 771 | 'selectors' => [ |
| 772 | '{{WRAPPER}} .eael-toc .eael-toc-body ul.eael-toc-list.eael-toc-bullet li:before' => 'top: {{SIZE}}{{UNIT}};', |
| 773 | ], |
| 774 | 'condition' => [ |
| 775 | 'eael_ext_toc_list_icon' => 'bullet', |
| 776 | ], |
| 777 | ] |
| 778 | ); |
| 779 | |
| 780 | $element->add_group_control( |
| 781 | Group_Control_Border::get_type(), |
| 782 | [ |
| 783 | 'name' => 'eael_ext_toc_border', |
| 784 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 785 | 'selector' => '{{WRAPPER}} .eael-toc,{{WRAPPER}} button.eael-toc-button', |
| 786 | 'condition' => [ |
| 787 | 'eael_ext_table_of_content' => 'yes', |
| 788 | ], |
| 789 | ] |
| 790 | ); |
| 791 | |
| 792 | $element->add_group_control( |
| 793 | Group_Control_Box_Shadow::get_type(), |
| 794 | [ |
| 795 | 'name' => 'eael_ext_toc_table_box_shadow', |
| 796 | 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'), |
| 797 | 'selector' => '{{WRAPPER}} .eael-toc:not(.collapsed)', |
| 798 | 'condition' => [ |
| 799 | 'eael_ext_table_of_content' => 'yes', |
| 800 | ], |
| 801 | ] |
| 802 | ); |
| 803 | |
| 804 | $element->add_control( |
| 805 | 'eael_ext_toc_box_border_radius', |
| 806 | [ |
| 807 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 808 | 'type' => Controls_Manager::SLIDER, |
| 809 | 'size_units' => ['px'], |
| 810 | 'range' => [ |
| 811 | 'px' => [ |
| 812 | 'min' => 0, |
| 813 | 'max' => 50, |
| 814 | 'step' => 1, |
| 815 | ], |
| 816 | ], |
| 817 | 'default' => [ |
| 818 | 'unit' => 'px', |
| 819 | 'size' => 5, |
| 820 | ], |
| 821 | 'selectors' => [ |
| 822 | '{{WRAPPER}} .eael-toc:not(.eael-toc-right)' => 'border-top-right-radius: {{SIZE}}{{UNIT}}; border-bottom-right-radius: {{SIZE}}{{UNIT}};', |
| 823 | '{{WRAPPER}} .eael-toc:not(.eael-toc-right) .eael-toc-header' => 'border-top-right-radius: {{SIZE}}{{UNIT}};', |
| 824 | '{{WRAPPER}} .eael-toc:not(.eael-toc-right) .eael-toc-body' => 'border-bottom-right-radius: {{SIZE}}{{UNIT}};', |
| 825 | |
| 826 | '{{WRAPPER}} .eael-toc.eael-toc-right' => 'border-top-left-radius: {{SIZE}}{{UNIT}}; border-bottom-left-radius: {{SIZE}}{{UNIT}};', |
| 827 | '{{WRAPPER}} .eael-toc.eael-toc-right .eael-toc-header' => 'border-top-left-radius: {{SIZE}}{{UNIT}};', |
| 828 | '{{WRAPPER}} .eael-toc.eael-toc-right .eael-toc-body' => 'border-bottom-left-radius: {{SIZE}}{{UNIT}};', |
| 829 | ], |
| 830 | 'condition' => [ |
| 831 | 'eael_ext_table_of_content' => 'yes', |
| 832 | ], |
| 833 | ] |
| 834 | ); |
| 835 | |
| 836 | $element->end_controls_section(); |
| 837 | |
| 838 | $element->start_controls_section( |
| 839 | 'eael_ext_table_of_content_header_style', |
| 840 | [ |
| 841 | 'label' => esc_html__('EA TOC Header', 'essential-addons-for-elementor-lite'), |
| 842 | 'tab' => Controls_Manager::TAB_STYLE, |
| 843 | 'condition' => [ |
| 844 | 'eael_ext_table_of_content' => 'yes', |
| 845 | ], |
| 846 | ] |
| 847 | ); |
| 848 | |
| 849 | $element->add_control( |
| 850 | 'eael_ext_table_of_content_header_bg', |
| 851 | [ |
| 852 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 853 | 'type' => Controls_Manager::COLOR, |
| 854 | 'default' => '#ff7d50', |
| 855 | 'selectors' => [ |
| 856 | '{{WRAPPER}} .eael-toc .eael-toc-header' => 'background-color: {{VALUE}}', |
| 857 | '{{WRAPPER}} .eael-toc.collapsed .eael-toc-button' => 'background-color: {{VALUE}}', |
| 858 | ], |
| 859 | ] |
| 860 | ); |
| 861 | |
| 862 | $element->add_control( |
| 863 | 'eael_ext_table_of_content_header_text_color', |
| 864 | [ |
| 865 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 866 | 'type' => Controls_Manager::COLOR, |
| 867 | 'default' => '#ffffff', |
| 868 | 'selectors' => [ |
| 869 | '{{WRAPPER}} .eael-toc .eael-toc-header .eael-toc-title' => 'color: {{VALUE}}', |
| 870 | '{{WRAPPER}} .eael-toc.collapsed .eael-toc-button' => 'color: {{VALUE}}', |
| 871 | ], |
| 872 | ] |
| 873 | ); |
| 874 | |
| 875 | $element->add_group_control( |
| 876 | Group_Control_Typography::get_type(), |
| 877 | [ |
| 878 | 'name' => 'eael_ext_table_of_content_header_typography', |
| 879 | 'selector' => '{{WRAPPER}} .eael-toc-header .eael-toc-title,{{WRAPPER}} .eael-toc.collapsed .eael-toc-button', |
| 880 | 'global' => [ |
| 881 | 'default' => Global_Typography::TYPOGRAPHY_SECONDARY |
| 882 | ], |
| 883 | ] |
| 884 | ); |
| 885 | |
| 886 | $element->add_control( |
| 887 | 'eael_ext_toc_header_padding', |
| 888 | [ |
| 889 | 'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'), |
| 890 | 'type' => Controls_Manager::DIMENSIONS, |
| 891 | 'size_units' => ['px'], |
| 892 | 'selectors' => [ |
| 893 | '{{WRAPPER}} .eael-toc .eael-toc-header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 894 | ], |
| 895 | ] |
| 896 | ); |
| 897 | |
| 898 | $element->add_control( |
| 899 | 'eael_ext_toc_header_collapse_close_button', |
| 900 | [ |
| 901 | 'label' => __('Collapse', 'essential-addons-for-elementor-lite'), |
| 902 | 'type' => Controls_Manager::HEADING, |
| 903 | 'separator' => 'before', |
| 904 | ] |
| 905 | ); |
| 906 | |
| 907 | $element->add_control( |
| 908 | 'eael_ext_table_of_content_header_icon', |
| 909 | [ |
| 910 | 'label' => __('Icon', 'essential-addons-for-elementor-lite'), |
| 911 | 'type' => Controls_Manager::ICONS, |
| 912 | 'label_block' => true, |
| 913 | 'default' => [ |
| 914 | 'value' => 'fas fa-list', |
| 915 | 'library' => 'fa-solid', |
| 916 | ], |
| 917 | 'fa4compatibility' => 'icon', |
| 918 | ] |
| 919 | ); |
| 920 | |
| 921 | $element->add_control( |
| 922 | 'eael_ext_toc_close_button_text_style', |
| 923 | [ |
| 924 | 'label' => __('Text Orientation', 'essential-addons-for-elementor-lite'), |
| 925 | 'type' => Controls_Manager::SELECT, |
| 926 | 'default' => 'top_to_bottom', |
| 927 | 'options' => [ |
| 928 | 'top_to_bottom' => __('Top to Bottom', 'essential-addons-for-elementor-lite'), |
| 929 | 'bottom_to_top' => __('Bottom to Top', 'essential-addons-for-elementor-lite'), |
| 930 | ], |
| 931 | ] |
| 932 | ); |
| 933 | |
| 934 | $element->add_control( |
| 935 | 'eael_ext_table_of_content_close_button', |
| 936 | [ |
| 937 | 'label' => __('Close Button', 'essential-addons-for-elementor-lite'), |
| 938 | 'type' => Controls_Manager::HEADING, |
| 939 | 'separator' => 'before', |
| 940 | ] |
| 941 | ); |
| 942 | |
| 943 | $element->add_control( |
| 944 | 'eael_ext_table_of_content_close_button_icon_size', |
| 945 | [ |
| 946 | 'label' => __('Icon Size', 'essential-addons-for-elementor-lite'), |
| 947 | 'type' => Controls_Manager::SLIDER, |
| 948 | 'size_units' => ['px'], |
| 949 | 'range' => [ |
| 950 | 'px' => [ |
| 951 | 'min' => 0, |
| 952 | 'max' => 100, |
| 953 | ], |
| 954 | ], |
| 955 | 'selectors' => [ |
| 956 | '{{WRAPPER}} .eael-toc .eael-toc-close' => 'font-size: {{SIZE}}{{UNIT}};', |
| 957 | ], |
| 958 | ] |
| 959 | ); |
| 960 | |
| 961 | $element->add_control( |
| 962 | 'eael_ext_table_of_content_close_button_size', |
| 963 | [ |
| 964 | 'label' => __('Button Size', 'essential-addons-for-elementor-lite'), |
| 965 | 'type' => Controls_Manager::SLIDER, |
| 966 | 'size_units' => ['px'], |
| 967 | 'range' => [ |
| 968 | 'px' => [ |
| 969 | 'min' => 0, |
| 970 | 'max' => 100, |
| 971 | ], |
| 972 | ], |
| 973 | 'selectors' => [ |
| 974 | '{{WRAPPER}} .eael-toc .eael-toc-close' => 'height: {{SIZE}}{{UNIT}};width: {{SIZE}}{{UNIT}};', |
| 975 | ], |
| 976 | ] |
| 977 | ); |
| 978 | |
| 979 | $element->add_control( |
| 980 | 'eael_ext_table_of_content_close_button_line_height', |
| 981 | [ |
| 982 | 'label' => __('Line Height', 'essential-addons-for-elementor-lite'), |
| 983 | 'type' => Controls_Manager::SLIDER, |
| 984 | 'size_units' => ['px'], |
| 985 | 'range' => [ |
| 986 | 'px' => [ |
| 987 | 'min' => 0, |
| 988 | 'max' => 100, |
| 989 | ], |
| 990 | ], |
| 991 | 'selectors' => [ |
| 992 | '{{WRAPPER}} .eael-toc .eael-toc-close' => 'line-height: {{SIZE}}{{UNIT}};', |
| 993 | ], |
| 994 | ] |
| 995 | ); |
| 996 | |
| 997 | $element->add_control( |
| 998 | 'eael_ext_table_of_content_close_button_bg', |
| 999 | [ |
| 1000 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1001 | 'type' => Controls_Manager::COLOR, |
| 1002 | 'default' => '#ffffff', |
| 1003 | 'selectors' => [ |
| 1004 | '{{WRAPPER}} .eael-toc .eael-toc-close' => 'background-color: {{VALUE}}', |
| 1005 | ], |
| 1006 | ] |
| 1007 | ); |
| 1008 | |
| 1009 | $element->add_control( |
| 1010 | 'eael_ext_table_of_content_close_button_text_color', |
| 1011 | [ |
| 1012 | 'label' => __('Close Button Color', 'essential-addons-for-elementor-lite'), |
| 1013 | 'type' => Controls_Manager::COLOR, |
| 1014 | 'default' => '#ff7d50', |
| 1015 | 'selectors' => [ |
| 1016 | '{{WRAPPER}} .eael-toc .eael-toc-close' => 'color: {{VALUE}}', |
| 1017 | ], |
| 1018 | ] |
| 1019 | ); |
| 1020 | |
| 1021 | $element->add_control( |
| 1022 | 'eael_ext_table_of_content_close_button_border_radius', |
| 1023 | [ |
| 1024 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 1025 | 'type' => Controls_Manager::SLIDER, |
| 1026 | 'size_units' => ['px'], |
| 1027 | 'range' => [ |
| 1028 | 'px' => [ |
| 1029 | 'min' => 0, |
| 1030 | 'max' => 100, |
| 1031 | ], |
| 1032 | ], |
| 1033 | 'selectors' => [ |
| 1034 | '{{WRAPPER}} .eael-toc .eael-toc-close' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 1035 | ], |
| 1036 | ] |
| 1037 | ); |
| 1038 | |
| 1039 | $element->add_group_control( |
| 1040 | Group_Control_Box_Shadow::get_type(), |
| 1041 | [ |
| 1042 | 'name' => 'eael_ext_table_of_content_close_button_box_shadow', |
| 1043 | 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'), |
| 1044 | 'selector' => '{{WRAPPER}} .eael-toc .eael-toc-close', |
| 1045 | ] |
| 1046 | ); |
| 1047 | |
| 1048 | $element->end_controls_section(); |
| 1049 | |
| 1050 | $element->start_controls_section( |
| 1051 | 'eael_ext_table_of_content_list_style_section', |
| 1052 | [ |
| 1053 | 'label' => esc_html__('EA TOC Body', 'essential-addons-for-elementor-lite'), |
| 1054 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1055 | 'condition' => [ |
| 1056 | 'eael_ext_table_of_content' => 'yes', |
| 1057 | ], |
| 1058 | ] |
| 1059 | ); |
| 1060 | |
| 1061 | $element->add_control( |
| 1062 | 'eael_ext_table_of_content_body_bg', |
| 1063 | [ |
| 1064 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1065 | 'type' => Controls_Manager::COLOR, |
| 1066 | 'default' => '#fff6f3', |
| 1067 | 'selectors' => [ |
| 1068 | '{{WRAPPER}} .eael-toc .eael-toc-body' => 'background-color: {{VALUE}}', |
| 1069 | ], |
| 1070 | |
| 1071 | ] |
| 1072 | ); |
| 1073 | |
| 1074 | $element->add_control( |
| 1075 | 'eael_ext_toc_body_padding', |
| 1076 | [ |
| 1077 | 'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'), |
| 1078 | 'type' => Controls_Manager::DIMENSIONS, |
| 1079 | 'size_units' => ['px'], |
| 1080 | 'selectors' => [ |
| 1081 | '{{WRAPPER}} .eael-toc .eael-toc-body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1082 | ], |
| 1083 | ] |
| 1084 | ); |
| 1085 | |
| 1086 | $element->add_control( |
| 1087 | 'eael_ext_table_of_content_list_style_separator', |
| 1088 | [ |
| 1089 | 'label' => __('List', 'essential-addons-for-elementor-lite'), |
| 1090 | 'type' => Controls_Manager::HEADING, |
| 1091 | 'separator' => 'before', |
| 1092 | ] |
| 1093 | ); |
| 1094 | |
| 1095 | $element->add_control( |
| 1096 | 'eael_ext_table_of_content_list_style', |
| 1097 | [ |
| 1098 | 'label' => __('Indicator Style', 'essential-addons-for-elementor-lite'), |
| 1099 | 'type' => Controls_Manager::SELECT, |
| 1100 | 'default' => 'none', |
| 1101 | 'options' => [ |
| 1102 | 'none' => __('None', 'essential-addons-for-elementor-lite'), |
| 1103 | 'arrow' => __('Arrow', 'essential-addons-for-elementor-lite'), |
| 1104 | 'bar' => __('Bar', 'essential-addons-for-elementor-lite'), |
| 1105 | ], |
| 1106 | ] |
| 1107 | ); |
| 1108 | |
| 1109 | $element->add_control( |
| 1110 | 'eael_ext_toc_indicator_color', |
| 1111 | [ |
| 1112 | 'label' => __('Indicator Color', 'essential-addons-for-elementor-lite'), |
| 1113 | 'type' => Controls_Manager::COLOR, |
| 1114 | 'default' => '#ff7d50', |
| 1115 | 'selectors' => [ |
| 1116 | '{{WRAPPER}} .eael-toc .eael-toc-body ul.eael-toc-list.eael-toc-list-bar li.eael-highlight-active > a:after' => 'background-color: {{VALUE}}', |
| 1117 | '{{WRAPPER}} .eael-toc .eael-toc-body ul.eael-toc-list.eael-toc-list-arrow li.eael-highlight-active > a:before' => 'border-bottom: 10px solid {{VALUE}}', |
| 1118 | ], |
| 1119 | 'condition' => [ |
| 1120 | 'eael_ext_table_of_content_list_style' => [ 'arrow', 'bar' ] |
| 1121 | ], |
| 1122 | ] |
| 1123 | ); |
| 1124 | |
| 1125 | $element->add_control( |
| 1126 | 'eael_ext_toc_indicator_size', |
| 1127 | [ |
| 1128 | 'label' => __('Indicator Size', 'essential-addons-for-elementor-lite'), |
| 1129 | 'type' => Controls_Manager::SLIDER, |
| 1130 | 'size_units' => ['px'], |
| 1131 | 'range' => [ |
| 1132 | 'px' => [ |
| 1133 | 'min' => 0, |
| 1134 | 'max' => 100, |
| 1135 | 'step' => 1, |
| 1136 | ], |
| 1137 | ], |
| 1138 | 'default' => [ |
| 1139 | 'unit' => 'px', |
| 1140 | 'size' => 20, |
| 1141 | ], |
| 1142 | 'selectors' => [ |
| 1143 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-list-bar li.eael-highlight-active > a:after' => 'height: {{SIZE}}{{UNIT}};', |
| 1144 | ], |
| 1145 | 'condition' => [ |
| 1146 | 'eael_ext_table_of_content_list_style' => 'bar', |
| 1147 | ], |
| 1148 | ] |
| 1149 | ); |
| 1150 | |
| 1151 | $element->add_control( |
| 1152 | 'eael_ext_toc_indicator_position', |
| 1153 | [ |
| 1154 | 'label' => __('Indicator Position', 'essential-addons-for-elementor-lite'), |
| 1155 | 'type' => Controls_Manager::SLIDER, |
| 1156 | 'size_units' => ['px'], |
| 1157 | 'range' => [ |
| 1158 | 'px' => [ |
| 1159 | 'min' => -100, |
| 1160 | 'max' => 100, |
| 1161 | 'step' => 1, |
| 1162 | ], |
| 1163 | ], |
| 1164 | 'default' => [ |
| 1165 | 'unit' => 'px', |
| 1166 | 'size' => 0, |
| 1167 | ], |
| 1168 | 'selectors' => [ |
| 1169 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-list-arrow li.eael-highlight-active > a:before' => 'margin-top: {{SIZE}}{{UNIT}};', |
| 1170 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-list-bar li.eael-highlight-active > a:after' => 'margin-top: {{SIZE}}{{UNIT}};', |
| 1171 | ], |
| 1172 | 'condition' => [ |
| 1173 | 'eael_ext_table_of_content_list_style!' => 'none', |
| 1174 | ], |
| 1175 | ] |
| 1176 | ); |
| 1177 | |
| 1178 | $element->add_group_control( |
| 1179 | Group_Control_Typography::get_type(), |
| 1180 | [ |
| 1181 | 'name' => 'eael_ext_table_of_content_list_typography_normal', |
| 1182 | 'selector' => '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list', |
| 1183 | 'global' => [ |
| 1184 | 'default' => Global_Typography::TYPOGRAPHY_SECONDARY |
| 1185 | ], |
| 1186 | ] |
| 1187 | ); |
| 1188 | |
| 1189 | $element->start_controls_tabs('ea_toc_list_style'); |
| 1190 | |
| 1191 | $element->start_controls_tab('normal', |
| 1192 | [ |
| 1193 | 'label' => __('Normal', 'essential-addons-for-elementor-lite'), |
| 1194 | ] |
| 1195 | ); |
| 1196 | |
| 1197 | $element->add_control( |
| 1198 | 'eael_ext_table_of_content_list_text_color', |
| 1199 | [ |
| 1200 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 1201 | 'type' => Controls_Manager::COLOR, |
| 1202 | 'default' => '#707070', |
| 1203 | 'selectors' => [ |
| 1204 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li' => 'color: {{VALUE}}', |
| 1205 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-number li:before' => 'color: {{VALUE}}', |
| 1206 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-bullet li:before' => 'background-color: {{VALUE}}', |
| 1207 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li a' => 'color: {{VALUE}}', |
| 1208 | ], |
| 1209 | ] |
| 1210 | ); |
| 1211 | |
| 1212 | $element->end_controls_tab(); |
| 1213 | |
| 1214 | $element->start_controls_tab('hover', |
| 1215 | [ |
| 1216 | 'label' => __('Hover', 'essential-addons-for-elementor-lite'), |
| 1217 | ] |
| 1218 | ); |
| 1219 | |
| 1220 | $element->add_control( |
| 1221 | 'eael_ext_table_of_list_hover_color', |
| 1222 | [ |
| 1223 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 1224 | 'type' => Controls_Manager::COLOR, |
| 1225 | 'default' => '#ff7d50', |
| 1226 | 'selectors' => [ |
| 1227 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li:hover' => 'color: {{VALUE}}', |
| 1228 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-number li:hover:before' => 'color: {{VALUE}}', |
| 1229 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-bullet li:hover:before' => 'background-color: {{VALUE}}', |
| 1230 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li:hover > a' => 'color: {{VALUE}}', |
| 1231 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li:hover > a:before' => 'border-bottom-color: {{VALUE}}', |
| 1232 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li:hover > a:after' => 'background-color: {{VALUE}}', |
| 1233 | ], |
| 1234 | |
| 1235 | ] |
| 1236 | ); |
| 1237 | |
| 1238 | $element->end_controls_tab(); // hover |
| 1239 | |
| 1240 | $element->start_controls_tab('active', |
| 1241 | [ |
| 1242 | 'label' => __('Active', 'essential-addons-for-elementor-lite'), |
| 1243 | ] |
| 1244 | ); |
| 1245 | |
| 1246 | $element->add_control( |
| 1247 | 'eael_ext_table_of_content_list_text_color_active', |
| 1248 | [ |
| 1249 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 1250 | 'type' => Controls_Manager::COLOR, |
| 1251 | 'default' => '#ff7d50', |
| 1252 | 'selectors' => [ |
| 1253 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li.eael-highlight-active' => 'color: {{VALUE}}', |
| 1254 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-number li.eael-highlight-active:before' => 'color: {{VALUE}}', |
| 1255 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-bullet li.eael-highlight-active:before' => 'background-color: {{VALUE}}', |
| 1256 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li.eael-highlight-active > a' => 'color: {{VALUE}}', |
| 1257 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li.eael-highlight-active > a:before' => 'border-bottom-color: {{VALUE}}', |
| 1258 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li.eael-highlight-active > a:after' => 'background-color: {{VALUE}}', |
| 1259 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li.eael-highlight-parent' => 'color: {{VALUE}}', |
| 1260 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-number li.eael-highlight-parent:before' => 'color: {{VALUE}}', |
| 1261 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list.eael-toc-bullet li.eael-highlight-parent:before' => 'background-color: {{VALUE}}', |
| 1262 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li.eael-highlight-parent > a' => 'color: {{VALUE}}', |
| 1263 | ], |
| 1264 | ] |
| 1265 | ); |
| 1266 | |
| 1267 | $element->end_controls_tab(); // active |
| 1268 | $element->end_controls_tabs(); |
| 1269 | |
| 1270 | $element->add_control( |
| 1271 | 'eael_ext_toc_top_level_space', |
| 1272 | [ |
| 1273 | 'label' => __('Top Level Space', 'essential-addons-for-elementor-lite'), |
| 1274 | 'type' => Controls_Manager::SLIDER, |
| 1275 | 'size_units' => ['px'], |
| 1276 | 'range' => [ |
| 1277 | 'px' => [ |
| 1278 | 'min' => 0, |
| 1279 | 'max' => 50, |
| 1280 | 'step' => 1, |
| 1281 | ], |
| 1282 | ], |
| 1283 | 'default' => [ |
| 1284 | 'unit' => 'px', |
| 1285 | 'size' => 8, |
| 1286 | ], |
| 1287 | 'selectors' => [ |
| 1288 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};', |
| 1289 | ], |
| 1290 | 'condition' => [ |
| 1291 | 'eael_ext_table_of_content' => 'yes', |
| 1292 | ], |
| 1293 | ] |
| 1294 | ); |
| 1295 | |
| 1296 | $element->add_control( |
| 1297 | 'eael_ext_toc_subitem_level_space', |
| 1298 | [ |
| 1299 | 'label' => __('Sub Item Space', 'essential-addons-for-elementor-lite'), |
| 1300 | 'type' => Controls_Manager::SLIDER, |
| 1301 | 'size_units' => ['px'], |
| 1302 | 'range' => [ |
| 1303 | 'px' => [ |
| 1304 | 'min' => 0, |
| 1305 | 'max' => 20, |
| 1306 | 'step' => 1, |
| 1307 | ], |
| 1308 | ], |
| 1309 | 'default' => [ |
| 1310 | 'unit' => 'px', |
| 1311 | 'size' => 1, |
| 1312 | ], |
| 1313 | 'selectors' => [ |
| 1314 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list li ul li' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};', |
| 1315 | ], |
| 1316 | 'condition' => [ |
| 1317 | 'eael_ext_table_of_content' => 'yes', |
| 1318 | ], |
| 1319 | ] |
| 1320 | ); |
| 1321 | |
| 1322 | $element->add_control( |
| 1323 | 'eael_ext_table_of_content_list_separator', |
| 1324 | [ |
| 1325 | 'label' => __('Separator', 'essential-addons-for-elementor-lite'), |
| 1326 | 'type' => Controls_Manager::HEADING, |
| 1327 | 'separator' => 'before', |
| 1328 | ] |
| 1329 | ); |
| 1330 | |
| 1331 | $element->add_control( |
| 1332 | 'eael_ext_table_of_content_list_separator_style', |
| 1333 | [ |
| 1334 | 'label' => __('Style', 'essential-addons-for-elementor-lite'), |
| 1335 | 'type' => Controls_Manager::SELECT, |
| 1336 | 'default' => 'dashed', |
| 1337 | 'options' => [ |
| 1338 | 'solid' => __('Solid', 'essential-addons-for-elementor-lite'), |
| 1339 | 'dashed' => __('Dashed', 'essential-addons-for-elementor-lite'), |
| 1340 | 'dotted' => __('Dotted', 'essential-addons-for-elementor-lite'), |
| 1341 | 'none' => __('None', 'essential-addons-for-elementor-lite'), |
| 1342 | ], |
| 1343 | 'selectors' => [ |
| 1344 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list > li:not(:last-child)' => 'border-bottom: 0.5px {{VALUE}}', |
| 1345 | ], |
| 1346 | ] |
| 1347 | ); |
| 1348 | |
| 1349 | $element->add_control( |
| 1350 | 'eael_ext_table_of_content_list_separator_color', |
| 1351 | [ |
| 1352 | 'label' => __('Color', 'essential-addons-for-elementor-lite'), |
| 1353 | 'type' => Controls_Manager::COLOR, |
| 1354 | 'selectors' => [ |
| 1355 | '{{WRAPPER}} .eael-toc .eael-toc-body .eael-toc-list > li:not(:last-child)' => 'border-bottom-color: {{VALUE}}', |
| 1356 | ], |
| 1357 | 'default' => '#c6c4cf', |
| 1358 | 'condition' => [ |
| 1359 | 'eael_ext_table_of_content_list_separator_style!' => 'none', |
| 1360 | ], |
| 1361 | ] |
| 1362 | ); |
| 1363 | |
| 1364 | $element->end_controls_section(); |
| 1365 | } |
| 1366 | } |
| 1367 |