templates
1 year ago
Accordion.php
1 year ago
Alerts_Box.php
1 year ago
Before_after.php
1 year ago
Blog_Grid.php
1 year ago
Cheat_Sheet.php
1 year ago
Counter.php
1 year ago
Icon_Box.php
1 year ago
Integrations.php
1 year ago
List_Item.php
1 year ago
Tabs.php
1 year ago
Team_Carousel.php
1 year ago
Testimonial.php
1 year ago
Timeline.php
1 year ago
Video_Playlist.php
1 year ago
Video_Popup.php
1 year ago
Icon_Box.php
988 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Use namespace to avoid conflict |
| 4 | */ |
| 5 | |
| 6 | namespace SPEL\Widgets; |
| 7 | |
| 8 | use Elementor\Controls_Manager; |
| 9 | use Elementor\Group_Control_Text_Shadow; |
| 10 | use Elementor\Group_Control_Text_Stroke; |
| 11 | use Elementor\Group_Control_Typography; |
| 12 | use Elementor\Group_Control_Box_Shadow; |
| 13 | use Elementor\Repeater; |
| 14 | use Elementor\Widget_Base; |
| 15 | |
| 16 | |
| 17 | // Exit if accessed directly |
| 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | exit; |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Class Dual-button |
| 24 | * @package spider\Widgets |
| 25 | */ |
| 26 | class Icon_Box extends Widget_Base { |
| 27 | |
| 28 | public function get_name() { |
| 29 | return 'spel_icon_box'; // ID of the widget (Don't change this name) |
| 30 | } |
| 31 | |
| 32 | public function get_title() { |
| 33 | return esc_html__( 'Icon Box', 'spider-elements' ); |
| 34 | } |
| 35 | |
| 36 | public function get_icon() { |
| 37 | return 'eicon-icon-box spel-icon'; |
| 38 | } |
| 39 | |
| 40 | public function get_keywords() { |
| 41 | return [ |
| 42 | 'spider', |
| 43 | 'spider elements', |
| 44 | 'icon', |
| 45 | 'box', |
| 46 | 'icon-box', |
| 47 | 'icon box', |
| 48 | 'card', |
| 49 | 'img box', |
| 50 | 'image box', |
| 51 | 'svg' |
| 52 | ]; |
| 53 | } |
| 54 | |
| 55 | public function get_categories() { |
| 56 | return [ 'spider-elements' ]; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Name: get_style_depends() |
| 61 | * Desc: Register the required CSS dependencies for the frontend. |
| 62 | */ |
| 63 | public function get_style_depends() { |
| 64 | return [ 'spel-main', 'elegant-icon' ]; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Name: get_script_depends() |
| 69 | * Desc: Register the required JS dependencies for the frontend. |
| 70 | */ |
| 71 | public function get_script_depends() { |
| 72 | return [ 'spel-el-widgets' ]; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | /** |
| 77 | * Name: register_controls() |
| 78 | * Desc: Register controls for these widgets |
| 79 | * Params: no params |
| 80 | * Return: @void |
| 81 | * Since: @1.0.0 |
| 82 | * Package: @spider-elements |
| 83 | * Author: spider-themes |
| 84 | */ |
| 85 | protected function register_controls() { |
| 86 | $this->elementor_content_control(); |
| 87 | $this->elementor_style_control(); |
| 88 | |
| 89 | } |
| 90 | |
| 91 | |
| 92 | /** |
| 93 | * Name: elementor_content_control() |
| 94 | * Desc: Register the Content Tab output on the Elementor editor. |
| 95 | * Params: no params |
| 96 | * Return: @void |
| 97 | * Since: @1.0.0 |
| 98 | * Package: @spider-elements |
| 99 | * Author: spider-themes |
| 100 | */ |
| 101 | public function elementor_content_control() { //start icon box settings |
| 102 | |
| 103 | //==================== Select Preset Skin ====================// |
| 104 | $this->start_controls_section( |
| 105 | 'counter_preset', [ |
| 106 | 'label' => esc_html__( 'Preset Skin', 'spider-elements' ), |
| 107 | ] |
| 108 | ); |
| 109 | |
| 110 | $this->add_control( |
| 111 | 'style', [ |
| 112 | 'label' => esc_html__( 'Skin', 'spider-elements' ), |
| 113 | 'type' => Controls_Manager::CHOOSE, |
| 114 | 'options' => [ |
| 115 | '1' => [ |
| 116 | 'title' => esc_html__( 'Style 01', 'spider-elements' ), |
| 117 | 'icon' => 'icon_box_1', |
| 118 | ], |
| 119 | '2' => [ |
| 120 | 'title' => esc_html__( 'Style 02', 'spider-elements' ), |
| 121 | 'icon' => 'icon_box_2', |
| 122 | ], |
| 123 | ], |
| 124 | 'toggle' => false, |
| 125 | 'default' => '1', |
| 126 | ] |
| 127 | ); |
| 128 | |
| 129 | $this->end_controls_section(); // End Preset Skin |
| 130 | |
| 131 | |
| 132 | //========================== Contents ========================// |
| 133 | $this->start_controls_section( |
| 134 | 'icon_box_content', [ |
| 135 | 'label' => esc_html__( 'Contents', 'spider-elements' ), |
| 136 | ] |
| 137 | ); |
| 138 | |
| 139 | $this->add_control( |
| 140 | 'i_box_icon', |
| 141 | [ |
| 142 | 'label' => esc_html__( 'Icon', 'spider-elements' ), |
| 143 | 'type' => Controls_Manager::ICONS, |
| 144 | 'separator' => 'before', |
| 145 | 'default' => [ |
| 146 | 'value' => 'fas fa-star', |
| 147 | 'library' => 'fa-solid', |
| 148 | ], |
| 149 | ] |
| 150 | ); |
| 151 | |
| 152 | |
| 153 | $this->add_control( |
| 154 | 'pro_box_icon', |
| 155 | [ |
| 156 | 'label' => esc_html__( 'Pro Feature Icon', 'spider-elements' ), |
| 157 | 'type' => Controls_Manager::ICONS, |
| 158 | 'skin' => 'inline', |
| 159 | 'label_block' => false, |
| 160 | 'default' => [ |
| 161 | 'value' => 'fas fa-crown', |
| 162 | 'library' => 'fa-solid', |
| 163 | ], |
| 164 | 'condition' => [ |
| 165 | 'style' => [ '2' ], |
| 166 | 'style!' => [ '1' ] |
| 167 | ], |
| 168 | ] |
| 169 | ); |
| 170 | |
| 171 | $this->add_control( |
| 172 | 'title', [ |
| 173 | 'label' => esc_html__( 'Title', 'spider-elements' ), |
| 174 | 'type' => Controls_Manager::TEXT, |
| 175 | 'default' => esc_html__( '50+ New Feature', 'spider-elements' ), |
| 176 | 'placeholder' => esc_html__( 'Enter your title', 'spider-elements' ), |
| 177 | 'label_block' => true, |
| 178 | 'dynamic' => [ |
| 179 | 'active' => true, |
| 180 | ], |
| 181 | ] |
| 182 | ); |
| 183 | |
| 184 | $this->add_control( |
| 185 | 'description', [ |
| 186 | 'label' => esc_html__( 'Description', 'spider-elements' ), |
| 187 | 'type' => Controls_Manager::TEXTAREA, |
| 188 | 'dynamic' => [ |
| 189 | 'active' => true, |
| 190 | ], |
| 191 | 'default' => esc_html__( 'Equipped with 70+ beautiful, vastly customizable addons.', 'spider-elements' ), |
| 192 | 'placeholder' => esc_html__( 'Enter your description', 'spider-elements' ), |
| 193 | 'rows' => 5, |
| 194 | 'condition' => [ |
| 195 | 'style' => [ '1' ], |
| 196 | 'style!' => [ '2' ] |
| 197 | ], |
| 198 | ] |
| 199 | ); |
| 200 | |
| 201 | $this->add_control( |
| 202 | 'box2_link', [ |
| 203 | 'label' => esc_html__( 'Link', 'spider-elements' ), |
| 204 | 'type' => Controls_Manager::URL, |
| 205 | 'options' => [ 'url', 'is_external', 'spider-elements' ], |
| 206 | 'label_block' => true, |
| 207 | 'dynamic' => [ |
| 208 | 'active' => true, |
| 209 | ], |
| 210 | 'condition' => [ |
| 211 | 'style' => [ '2' ], |
| 212 | 'style!' => [ '1' ] |
| 213 | ], |
| 214 | ] |
| 215 | ); |
| 216 | |
| 217 | $this->add_control( |
| 218 | 'box_title_tag', [ |
| 219 | 'label' => esc_html__( 'Title Tag', 'spider-elements' ), |
| 220 | 'type' => Controls_Manager::SELECT, |
| 221 | 'separator' => 'before', |
| 222 | 'default' => 'h5', |
| 223 | 'options' => spel_get_title_tags(), |
| 224 | ] |
| 225 | ); |
| 226 | |
| 227 | $this->end_controls_section(); // End icon box Settings |
| 228 | |
| 229 | $this->start_controls_section( |
| 230 | 'icon_box_btn', [ |
| 231 | 'label' => esc_html__( 'Button', 'spider-elements' ), |
| 232 | 'condition' => [ |
| 233 | 'style' => [ '1' ], |
| 234 | 'style!' => [ '2' ] |
| 235 | ], |
| 236 | ] |
| 237 | ); |
| 238 | |
| 239 | $this->add_control( |
| 240 | 'btn_text', |
| 241 | [ |
| 242 | 'label' => esc_html__( 'Text', 'spider-elements' ), |
| 243 | 'type' => Controls_Manager::TEXT, |
| 244 | 'default' => esc_html__( 'Click here', 'spider-elements' ), |
| 245 | 'placeholder' => esc_html__( 'Enter button text', 'spider-elements' ), |
| 246 | 'description' => esc_html__( '"Write your icon box button text"', 'spider-elements' ), |
| 247 | 'separator' => 'before', |
| 248 | 'dynamic' => [ |
| 249 | 'active' => true, |
| 250 | ], |
| 251 | ] |
| 252 | ); |
| 253 | |
| 254 | $this->add_control( |
| 255 | 'box_link', [ |
| 256 | 'label' => esc_html__( 'Link', 'spider-elements' ), |
| 257 | 'type' => Controls_Manager::URL, |
| 258 | 'options' => [ 'url', 'is_external', 'spider-elements' ], |
| 259 | 'label_block' => true, |
| 260 | 'dynamic' => [ |
| 261 | 'active' => true, |
| 262 | ], |
| 263 | ] |
| 264 | ); |
| 265 | |
| 266 | $this->add_control( |
| 267 | 'btn_icon', |
| 268 | [ |
| 269 | 'label' => esc_html__( 'Icon', 'spider-elements' ), |
| 270 | 'type' => Controls_Manager::ICONS, |
| 271 | 'skin' => 'inline', |
| 272 | 'label_block' => false, |
| 273 | 'default' => [ |
| 274 | 'value' => 'fas fa-arrow-right', |
| 275 | 'library' => 'fa-solid', |
| 276 | ], |
| 277 | ] |
| 278 | ); |
| 279 | |
| 280 | $this->end_controls_section(); // End icon box button Settings |
| 281 | |
| 282 | } |
| 283 | |
| 284 | |
| 285 | /** |
| 286 | * Name: elementor_style_control() |
| 287 | * Desc: Register the Style Tab output on the Elementor editor. |
| 288 | * Params: no params |
| 289 | * Return: @void |
| 290 | * Since: @1.0.0 |
| 291 | * Package: @spider-elements |
| 292 | * Author: spider-themes |
| 293 | */ |
| 294 | //==================Start Icon Box all style controls===============// |
| 295 | public function elementor_style_control() { |
| 296 | |
| 297 | //start Box style control section-------------------------// |
| 298 | $this->start_controls_section( |
| 299 | 'sec_title_style', [ |
| 300 | 'label' => esc_html__( 'Box', 'spider-elements' ), |
| 301 | 'tab' => Controls_Manager::TAB_STYLE, |
| 302 | ] |
| 303 | ); |
| 304 | |
| 305 | |
| 306 | $this->add_responsive_control( |
| 307 | 'box_text_align', |
| 308 | [ |
| 309 | 'label' => esc_html__( 'Text Alignment', 'spider-elements' ), |
| 310 | 'type' => Controls_Manager::CHOOSE, |
| 311 | 'options' => [ |
| 312 | 'left' => [ |
| 313 | 'title' => esc_html__( 'Left', 'spider-elements' ), |
| 314 | 'icon' => 'eicon-text-align-left', |
| 315 | ], |
| 316 | 'center' => [ |
| 317 | 'title' => esc_html__( 'Center', 'spider-elements' ), |
| 318 | 'icon' => 'eicon-text-align-center', |
| 319 | ], |
| 320 | 'right' => [ |
| 321 | 'title' => esc_html__( 'Right', 'spider-elements' ), |
| 322 | 'icon' => 'eicon-text-align-right', |
| 323 | ], |
| 324 | 'justify' => [ |
| 325 | 'title' => esc_html__( 'Justified', 'spider-elements' ), |
| 326 | 'icon' => 'eicon-text-align-justify', |
| 327 | ], |
| 328 | ], |
| 329 | 'selectors' => [ |
| 330 | '{{WRAPPER}} .icon_box_content' => 'text-align: {{VALUE}};', |
| 331 | '{{WRAPPER}} .icon_box_two' => 'text-align: {{VALUE}};', |
| 332 | ], |
| 333 | ] |
| 334 | ); |
| 335 | |
| 336 | $this->add_group_control( |
| 337 | \Elementor\Group_Control_Border::get_type(), |
| 338 | [ |
| 339 | 'name' => 'box-border', |
| 340 | 'selector' => '{{WRAPPER}} .icon_box, |
| 341 | {{WRAPPER}} .icon_box_two', |
| 342 | ] |
| 343 | ); |
| 344 | |
| 345 | $this->add_responsive_control( |
| 346 | 'box_border_radius', |
| 347 | [ |
| 348 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 349 | 'type' => Controls_Manager::DIMENSIONS, |
| 350 | 'size_units' => [ 'px', '%', 'em' ], |
| 351 | 'selectors' => [ |
| 352 | '{{WRAPPER}} .icon_box' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 353 | '{{WRAPPER}} .icon_box_two' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 354 | ], |
| 355 | ] |
| 356 | ); |
| 357 | |
| 358 | $this->add_responsive_control( |
| 359 | 'box_padding', |
| 360 | [ |
| 361 | 'label' => esc_html__( 'Padding', 'spider-elements' ), |
| 362 | 'type' => Controls_Manager::DIMENSIONS, |
| 363 | 'size_units' => [ 'px', 'em', '%' ], |
| 364 | 'selectors' => [ |
| 365 | '{{WRAPPER}} .box_bg_shape' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 366 | '{{WRAPPER}} .box2_bg_shape' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 367 | ], |
| 368 | 'separator' => 'after', |
| 369 | ] |
| 370 | ); |
| 371 | |
| 372 | //star icon box normal/hover style tabs------------// |
| 373 | $this->start_controls_tabs( |
| 374 | 'box_style_tabs' |
| 375 | ); |
| 376 | //start icon box normal style tab-------------// |
| 377 | $this->start_controls_tab( |
| 378 | 'box_normal_tab', |
| 379 | [ |
| 380 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 381 | |
| 382 | ] |
| 383 | ); |
| 384 | |
| 385 | $this->add_group_control( |
| 386 | \Elementor\Group_Control_Background::get_type(), |
| 387 | [ |
| 388 | 'name' => 'background', |
| 389 | 'types' => [ 'classic', 'gradient' ], |
| 390 | 'exclude' => [ 'image' ], |
| 391 | 'selector' => '{{WRAPPER}} .icon_box, |
| 392 | {{WRAPPER}} .icon_box_two', |
| 393 | ] |
| 394 | ); |
| 395 | |
| 396 | $this->add_group_control( |
| 397 | Group_Control_Box_Shadow::get_type(), [ |
| 398 | 'name' => 'icon_box_shadow', |
| 399 | 'selector' => '{{WRAPPER}} .icon_box, |
| 400 | {{WRAPPER}} .icon_box_two', |
| 401 | ] |
| 402 | ); |
| 403 | |
| 404 | |
| 405 | $this->end_controls_tab(); |
| 406 | //end icon box normal style tab-------------// |
| 407 | |
| 408 | //start icon box hover style tab-------------// |
| 409 | $this->start_controls_tab( |
| 410 | 'box_hover_tab', |
| 411 | [ |
| 412 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 413 | ] |
| 414 | ); |
| 415 | |
| 416 | $this->add_group_control( |
| 417 | \Elementor\Group_Control_Background::get_type(), |
| 418 | [ |
| 419 | 'name' => 'box_hover_background', |
| 420 | 'types' => [ 'classic', 'gradient' ], |
| 421 | 'exclude' => [ 'image' ], |
| 422 | 'selector' => '{{WRAPPER}} .icon_box:hover, |
| 423 | {{WRAPPER}} .icon_box_two:hover', |
| 424 | ] |
| 425 | ); |
| 426 | |
| 427 | $this->add_control( |
| 428 | 'text_hover_color', |
| 429 | [ |
| 430 | 'label' => esc_html__( 'Title Color', 'spider-elements' ), |
| 431 | 'type' => Controls_Manager::COLOR, |
| 432 | 'selectors' => [ |
| 433 | '{{WRAPPER}} .icon_box:hover .box_title' => 'color: {{VALUE}}', |
| 434 | '{{WRAPPER}} .icon_box_two:hover .box_two_title' => 'color: {{VALUE}}', |
| 435 | ], |
| 436 | ] |
| 437 | ); |
| 438 | |
| 439 | $this->add_control( |
| 440 | 'desc_hover_color', |
| 441 | [ |
| 442 | 'label' => esc_html__( 'Description Color', 'spider-elements' ), |
| 443 | 'type' => Controls_Manager::COLOR, |
| 444 | 'selectors' => [ |
| 445 | '{{WRAPPER}} .icon_box:hover .icon_box_description' => 'color: {{VALUE}}', |
| 446 | ], |
| 447 | 'condition' => [ |
| 448 | 'style' => [ '1' ], |
| 449 | 'style!' => [ '2' ] |
| 450 | ], |
| 451 | ] |
| 452 | ); |
| 453 | |
| 454 | $this->add_control( |
| 455 | 'icon_hover_color', |
| 456 | [ |
| 457 | 'label' => esc_html__( 'Icon Color', 'spider-elements' ), |
| 458 | 'type' => Controls_Manager::COLOR, |
| 459 | 'selectors' => [ |
| 460 | '{{WRAPPER}} .icon_box:hover .box_main_icon' => 'color: {{VALUE}}', |
| 461 | '{{WRAPPER}} .icon_box_two:hover .box_main_icon' => 'color: {{VALUE}}', |
| 462 | ], |
| 463 | ] |
| 464 | ); |
| 465 | |
| 466 | $this->add_control( |
| 467 | 'icon_bghover_color', |
| 468 | [ |
| 469 | 'label' => esc_html__( 'Icon Background', 'spider-elements' ), |
| 470 | 'type' => Controls_Manager::COLOR, |
| 471 | 'selectors' => [ |
| 472 | '{{WRAPPER}} .icon_box_two:hover .box_main_icon' => 'background: {{VALUE}}', |
| 473 | ], |
| 474 | 'condition' => [ |
| 475 | 'style' => [ '2' ], |
| 476 | 'style!' => [ '1' ] |
| 477 | ], |
| 478 | ] |
| 479 | ); |
| 480 | |
| 481 | $this->add_control( |
| 482 | 'btn_hover_color', |
| 483 | [ |
| 484 | 'label' => esc_html__( 'Button hover', 'spider-elements' ), |
| 485 | 'type' => Controls_Manager::COLOR, |
| 486 | 'selectors' => [ |
| 487 | '{{WRAPPER}} .icon_box:hover .box_button' => 'color: {{VALUE}}', |
| 488 | '{{WRAPPER}} .icon_box:hover .button_items i' => 'color: {{VALUE}}', |
| 489 | ], |
| 490 | 'condition' => [ |
| 491 | 'style' => [ '1' ], |
| 492 | 'style!' => [ '2' ] |
| 493 | ], |
| 494 | ] |
| 495 | ); |
| 496 | |
| 497 | $this->add_control( |
| 498 | 'border_hover_color', |
| 499 | [ |
| 500 | 'label' => esc_html__( 'Border Color', 'spider-elements' ), |
| 501 | 'type' => Controls_Manager::COLOR, |
| 502 | 'selectors' => [ |
| 503 | '{{WRAPPER}} .icon_box:hover' => 'border-color: {{VALUE}}', |
| 504 | '{{WRAPPER}} .icon_box_two:hover' => 'border-color: {{VALUE}}', |
| 505 | ], |
| 506 | ] |
| 507 | ); |
| 508 | |
| 509 | $this->add_group_control( |
| 510 | Group_Control_Box_Shadow::get_type(), [ |
| 511 | 'name' => 'icon_box_hover_shadow', |
| 512 | 'selector' => '{{WRAPPER}} .icon_box:hover, |
| 513 | {{WRAPPER}} .icon_box_two:hover', |
| 514 | ] |
| 515 | ); |
| 516 | |
| 517 | $this->end_controls_tab(); |
| 518 | //end icon box hover style tab-------------// |
| 519 | $this->end_controls_tabs(); |
| 520 | //star icon box normal/hover style tabs------------// |
| 521 | $this->end_controls_section(); |
| 522 | //end Box style control section------------------------------// |
| 523 | |
| 524 | |
| 525 | //start icon box contents section-----------------------------// |
| 526 | $this->start_controls_section( |
| 527 | 'box_contents', |
| 528 | [ |
| 529 | 'label' => esc_html__( 'Contents', 'spider-elements' ), |
| 530 | 'tab' => Controls_Manager::TAB_STYLE, |
| 531 | ] |
| 532 | ); |
| 533 | |
| 534 | //start icon box title style controls-------------// |
| 535 | $this->add_control( |
| 536 | 'title_heading', |
| 537 | [ |
| 538 | 'label' => esc_html__( 'Title', 'spider-elements' ), |
| 539 | 'type' => Controls_Manager::HEADING |
| 540 | ] |
| 541 | ); |
| 542 | |
| 543 | $this->add_group_control( |
| 544 | Group_Control_Typography::get_type(), |
| 545 | [ |
| 546 | 'name' => 'box_content_typo', |
| 547 | 'selector' => '{{WRAPPER}} .box_title, |
| 548 | {{WRAPPER}} .box_two_title', |
| 549 | ] |
| 550 | ); |
| 551 | |
| 552 | $this->add_control( |
| 553 | 'title_color', |
| 554 | [ |
| 555 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 556 | 'type' => Controls_Manager::COLOR, |
| 557 | 'selectors' => [ |
| 558 | '{{WRAPPER}} .box_title' => 'color: {{VALUE}}', |
| 559 | '{{WRAPPER}} .box_two_title' => 'color: {{VALUE}}', |
| 560 | ], |
| 561 | ] |
| 562 | ); |
| 563 | //end icon box title style controls------------------// |
| 564 | |
| 565 | //start icon box description style controls----------------// |
| 566 | $this->add_control( |
| 567 | 'desc_heading', |
| 568 | [ |
| 569 | 'label' => esc_html__( 'Description', 'spider-elements' ), |
| 570 | 'type' => Controls_Manager::HEADING, |
| 571 | 'separator' => 'before', |
| 572 | 'condition' => [ |
| 573 | 'style' => [ '1' ], |
| 574 | 'style!' => [ '2' ] |
| 575 | ], |
| 576 | ] |
| 577 | ); |
| 578 | |
| 579 | $this->add_group_control( |
| 580 | Group_Control_Typography::get_type(), |
| 581 | [ |
| 582 | 'name' => 'box_description_typo', |
| 583 | 'selector' => '{{WRAPPER}} .icon_box_description', |
| 584 | 'condition' => [ |
| 585 | 'style' => [ '1' ], |
| 586 | 'style!' => [ '2' ] |
| 587 | ], |
| 588 | ] |
| 589 | ); |
| 590 | |
| 591 | $this->add_control( |
| 592 | 'desc_color', |
| 593 | [ |
| 594 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 595 | 'type' => Controls_Manager::COLOR, |
| 596 | 'selectors' => [ |
| 597 | '{{WRAPPER}} .icon_box_description' => 'color: {{VALUE}}', |
| 598 | ], |
| 599 | 'condition' => [ |
| 600 | 'style' => [ '1' ], |
| 601 | 'style!' => [ '2' ] |
| 602 | ], |
| 603 | ] |
| 604 | ); |
| 605 | |
| 606 | $this->add_responsive_control( |
| 607 | 'box_desc_margin', |
| 608 | [ |
| 609 | 'label' => esc_html__( 'Margin', 'spider-elements' ), |
| 610 | 'type' => Controls_Manager::DIMENSIONS, |
| 611 | 'size_units' => [ 'px' ], |
| 612 | 'range' => [ |
| 613 | 'px' => [ |
| 614 | 'min' => - 100, |
| 615 | 'max' => 100, |
| 616 | 'step' => 5, |
| 617 | ], |
| 618 | ], |
| 619 | 'default' => [ |
| 620 | 'unit' => 'px', |
| 621 | 'size' => 10, |
| 622 | ], |
| 623 | 'selectors' => [ |
| 624 | '{{WRAPPER}} .icon_box_description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 625 | ], |
| 626 | 'condition' => [ |
| 627 | 'style' => [ '1' ], |
| 628 | 'style!' => [ '2' ] |
| 629 | ], |
| 630 | ] |
| 631 | ); |
| 632 | |
| 633 | $this->add_control( |
| 634 | 'box_btn_hrading', |
| 635 | [ |
| 636 | 'label' => esc_html__( 'Button', 'spider-elements' ), |
| 637 | 'type' => Controls_Manager::HEADING, |
| 638 | 'separator' => 'before', |
| 639 | 'condition' => [ |
| 640 | 'style' => [ '1' ], |
| 641 | 'style!' => [ '2' ] |
| 642 | ], |
| 643 | ] |
| 644 | ); |
| 645 | |
| 646 | $this->add_group_control( |
| 647 | Group_Control_Typography::get_type(), |
| 648 | [ |
| 649 | 'name' => 'box_btn_typo', |
| 650 | 'selector' => '{{WRAPPER}} .box_button, |
| 651 | {{WRAPPER}} .button_items i', |
| 652 | 'condition' => [ |
| 653 | 'style' => [ '1' ], |
| 654 | 'style!' => [ '2' ] |
| 655 | ], |
| 656 | ] |
| 657 | ); |
| 658 | |
| 659 | $this->add_control( |
| 660 | 'box_btn_color', |
| 661 | [ |
| 662 | 'label' => esc_html__( 'Button Color', 'spider-elements' ), |
| 663 | 'type' => Controls_Manager::COLOR, |
| 664 | 'selectors' => [ |
| 665 | '{{WRAPPER}} .box_button' => 'color: {{VALUE}}', |
| 666 | '{{WRAPPER}} .button_items i' => 'color: {{VALUE}}', |
| 667 | ], |
| 668 | 'condition' => [ |
| 669 | 'style' => [ '1' ], |
| 670 | 'style!' => [ '2' ] |
| 671 | ], |
| 672 | ] |
| 673 | ); |
| 674 | |
| 675 | $this->end_controls_section(); |
| 676 | //end icon box content style controls-------------------// |
| 677 | |
| 678 | |
| 679 | //start Icon style section----------------------// |
| 680 | $this->start_controls_section( |
| 681 | 'icon_style', |
| 682 | [ |
| 683 | 'label' => esc_html__( 'Icon', 'spider-elements' ), |
| 684 | 'tab' => Controls_Manager::TAB_STYLE, |
| 685 | ] |
| 686 | ); |
| 687 | |
| 688 | $this->add_responsive_control( |
| 689 | 'icon_vertical_alignment', |
| 690 | [ |
| 691 | 'label' => esc_html__( 'Vertical Alignment', 'spider-elements' ), |
| 692 | 'type' => Controls_Manager::CHOOSE, |
| 693 | 'options' => [ |
| 694 | 'flex-start' => [ |
| 695 | 'title' => esc_html__( 'Top', 'spider-elements' ), |
| 696 | 'icon' => 'eicon-v-align-top', |
| 697 | ], |
| 698 | 'center' => [ |
| 699 | 'title' => esc_html__( 'Middle', 'spider-elements' ), |
| 700 | 'icon' => 'eicon-v-align-middle', |
| 701 | ], |
| 702 | 'flex-end' => [ |
| 703 | 'title' => esc_html__( 'Bottom', 'spider-elements' ), |
| 704 | 'icon' => 'eicon-v-align-bottom', |
| 705 | ], |
| 706 | ], |
| 707 | 'default' => 'flex-start', |
| 708 | 'selectors' => [ |
| 709 | '{{WRAPPER}} .box_icon' => 'display: flex; align-items: {{VALUE}};', |
| 710 | ], |
| 711 | 'condition' => [ |
| 712 | 'style' => [ '1' ], |
| 713 | 'style!' => [ '2' ] |
| 714 | ], |
| 715 | ] |
| 716 | ); |
| 717 | |
| 718 | $this->add_control( |
| 719 | 'icon_color', |
| 720 | [ |
| 721 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 722 | 'type' => Controls_Manager::COLOR, |
| 723 | 'selectors' => [ |
| 724 | '{{WRAPPER}} .box_main_icon' => 'color: {{VALUE}}', |
| 725 | ], |
| 726 | ] |
| 727 | ); |
| 728 | |
| 729 | $this->add_control( |
| 730 | 'icon_bg_color', |
| 731 | [ |
| 732 | 'label' => esc_html__( 'Background', 'spider-elements' ), |
| 733 | 'type' => Controls_Manager::COLOR, |
| 734 | 'selectors' => [ |
| 735 | '{{WRAPPER}} .box_main_icon' => 'background: {{VALUE}}', |
| 736 | ], |
| 737 | 'condition' => [ |
| 738 | 'style' => [ '2' ], |
| 739 | 'style!' => [ '1' ] |
| 740 | ], |
| 741 | ] |
| 742 | ); |
| 743 | |
| 744 | |
| 745 | $this->add_responsive_control( |
| 746 | 'icon_size', |
| 747 | [ |
| 748 | 'label' => esc_html__( 'Size', 'spider-elements' ), |
| 749 | 'type' => Controls_Manager::SLIDER, |
| 750 | 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], |
| 751 | 'range' => [ |
| 752 | 'px' => [ |
| 753 | 'min' => 6, |
| 754 | 'max' => 300, |
| 755 | ], |
| 756 | ], |
| 757 | 'selectors' => [ |
| 758 | '{{WRAPPER}} .box_main_icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 759 | '{{WRAPPER}} .box_main_icon i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 760 | ], |
| 761 | ] |
| 762 | ); |
| 763 | |
| 764 | |
| 765 | $this->add_responsive_control( |
| 766 | 'box_icon_space', |
| 767 | [ |
| 768 | 'label' => esc_html__( 'Spacing', 'spider-elements' ), |
| 769 | 'type' => Controls_Manager::SLIDER, |
| 770 | 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], |
| 771 | 'default' => [ |
| 772 | 'size' => 20, |
| 773 | ], |
| 774 | 'range' => [ |
| 775 | 'px' => [ |
| 776 | 'max' => 200, |
| 777 | ], |
| 778 | 'em' => [ |
| 779 | 'max' => 10, |
| 780 | ], |
| 781 | 'rem' => [ |
| 782 | 'max' => 10, |
| 783 | ], |
| 784 | ], |
| 785 | 'selectors' => [ |
| 786 | '{{WRAPPER}} .box_main_icon' => 'margin-right: {{SIZE}}{{UNIT}}', |
| 787 | '{{WRAPPER}} .box_two_title' => 'margin-top: {{SIZE}}{{UNIT}}', |
| 788 | ], |
| 789 | ] |
| 790 | ); |
| 791 | |
| 792 | $this->add_responsive_control( |
| 793 | 'box_icon_padding', |
| 794 | [ |
| 795 | 'label' => esc_html__( 'Padding', 'spider-elements' ), |
| 796 | 'type' => Controls_Manager::DIMENSIONS, |
| 797 | 'size_units' => [ 'px' ], |
| 798 | 'range' => [ |
| 799 | 'px' => [ |
| 800 | 'min' => - 100, |
| 801 | 'max' => 100, |
| 802 | 'step' => 5, |
| 803 | ], |
| 804 | ], |
| 805 | 'default' => [ |
| 806 | 'unit' => 'px', |
| 807 | 'size' => 10, |
| 808 | ], |
| 809 | 'selectors' => [ |
| 810 | '{{WRAPPER}} .box_main_icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 811 | ], |
| 812 | 'condition' => [ |
| 813 | 'style' => [ '2' ], |
| 814 | 'style!' => [ '1' ] |
| 815 | ], |
| 816 | ] |
| 817 | ); |
| 818 | |
| 819 | $this->add_responsive_control( |
| 820 | 'box_icon_radius', [ |
| 821 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 822 | 'type' => Controls_Manager::DIMENSIONS, |
| 823 | 'size_units' => [ 'px', '%', 'em' ], |
| 824 | 'selectors' => [ |
| 825 | '{{WRAPPER}} .box_main_icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 826 | ], |
| 827 | 'condition' => [ |
| 828 | 'style' => [ '2' ], |
| 829 | 'style!' => [ '1' ] |
| 830 | ], |
| 831 | ] |
| 832 | ); |
| 833 | |
| 834 | $this->add_control( |
| 835 | 'icon_box_svg_color_option', |
| 836 | [ |
| 837 | 'label' => esc_html__( 'svg Color', 'spider-elements' ), |
| 838 | 'type' => Controls_Manager::HEADING, |
| 839 | 'separator' => 'before', |
| 840 | ] |
| 841 | ); |
| 842 | |
| 843 | $this->start_controls_tabs( |
| 844 | 'icon_box_svg_style_tabs' |
| 845 | ); |
| 846 | |
| 847 | //start svg normal---- |
| 848 | $this->start_controls_tab( |
| 849 | 'svg_normal_tab', |
| 850 | [ |
| 851 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 852 | ] |
| 853 | ); |
| 854 | |
| 855 | $this->add_control( |
| 856 | 'svg_color', |
| 857 | [ |
| 858 | 'label' => esc_html__( 'Stroke Color', 'spider-elements' ), |
| 859 | 'type' => Controls_Manager::COLOR, |
| 860 | 'selectors' => [ |
| 861 | '{{WRAPPER}} .box_main_icon svg path' => 'stroke: {{VALUE}}', |
| 862 | ], |
| 863 | ] |
| 864 | ); |
| 865 | |
| 866 | $this->add_control( |
| 867 | 'svg_fill_color', |
| 868 | [ |
| 869 | 'label' => esc_html__( 'Fill Color', 'spider-elements' ), |
| 870 | 'type' => Controls_Manager::COLOR, |
| 871 | 'selectors' => [ |
| 872 | '{{WRAPPER}} .box_main_icon svg path' => 'fill: {{VALUE}}', |
| 873 | ], |
| 874 | ] |
| 875 | ); |
| 876 | |
| 877 | $this->end_controls_tab(); //end svg normal-----// |
| 878 | |
| 879 | //start svg Hover ------ |
| 880 | $this->start_controls_tab( |
| 881 | 'svg_hover_tab', |
| 882 | [ |
| 883 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 884 | ] |
| 885 | ); |
| 886 | |
| 887 | $this->add_control( |
| 888 | 'svg_hover_color', |
| 889 | [ |
| 890 | 'label' => esc_html__( 'Stroke Color', 'spider-elements' ), |
| 891 | 'type' => Controls_Manager::COLOR, |
| 892 | 'selectors' => [ |
| 893 | '{{WRAPPER}} .icon_box:hover .box_bg_shape .box_icon .box_main_icon svg path' => 'stroke: {{VALUE}}', |
| 894 | '{{WRAPPER}} .icon_box_two:hover .box2_bg_shape .box_main_icon svg path' => 'stroke: {{VALUE}}', |
| 895 | ], |
| 896 | ] |
| 897 | ); |
| 898 | |
| 899 | $this->add_control( |
| 900 | 'svg_fill_hover_color', |
| 901 | [ |
| 902 | 'label' => esc_html__( 'Fill Color', 'spider-elements' ), |
| 903 | 'type' => Controls_Manager::COLOR, |
| 904 | 'selectors' => [ |
| 905 | '{{WRAPPER}} .icon_box:hover .box_bg_shape .box_icon .box_main_icon svg path' => 'fill: {{VALUE}}', |
| 906 | '{{WRAPPER}} .icon_box_two:hover .box2_bg_shape .box_main_icon svg path' => 'fill: {{VALUE}}', |
| 907 | ], |
| 908 | ] |
| 909 | ); |
| 910 | |
| 911 | $this->end_controls_tab(); //end svg hover//------ |
| 912 | |
| 913 | $this->end_controls_tabs(); //end normal/hover tabs/////----- |
| 914 | |
| 915 | $this->end_controls_section(); |
| 916 | //end icon box Icon and svg style section------------------------// |
| 917 | |
| 918 | |
| 919 | //start icon box background style section------------// |
| 920 | $this->start_controls_section( |
| 921 | 'icon_box_bg_section', |
| 922 | [ |
| 923 | 'label' => esc_html__( 'Background Shape', 'spider-elements' ), |
| 924 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 925 | ] |
| 926 | ); |
| 927 | |
| 928 | $this->start_controls_tabs( |
| 929 | 'iconbox_bg_style_tabs' |
| 930 | ); |
| 931 | |
| 932 | //===start BG normal===// |
| 933 | $this->start_controls_tab( |
| 934 | 'style_normal_tab', |
| 935 | [ |
| 936 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 937 | ] |
| 938 | ); |
| 939 | |
| 940 | $this->add_group_control( |
| 941 | \Elementor\Group_Control_Background::get_type(), |
| 942 | [ |
| 943 | 'name' => 'box_normal_background', |
| 944 | 'types' => [ 'classic', 'gradient' ], |
| 945 | 'selector' => '{{WRAPPER}} .box_bg_shape, |
| 946 | {{WRAPPER}} .box2_bg_shape', |
| 947 | ] |
| 948 | ); |
| 949 | |
| 950 | $this->end_controls_tab(); //end BG normal-----// |
| 951 | |
| 952 | //====start BG Hover =====// |
| 953 | $this->start_controls_tab( |
| 954 | 'style_hover_tab', |
| 955 | [ |
| 956 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 957 | ] |
| 958 | ); |
| 959 | |
| 960 | $this->add_group_control( |
| 961 | \Elementor\Group_Control_Background::get_type(), |
| 962 | [ |
| 963 | 'name' => 'hover_background', |
| 964 | 'types' => [ 'classic', 'gradient' ], |
| 965 | 'selector' => '{{WRAPPER}} .box_bg_shape:hover, |
| 966 | {{WRAPPER}} .box2_bg_shape:hover', |
| 967 | ] |
| 968 | ); |
| 969 | |
| 970 | $this->end_controls_tab(); //end BG hover//------ |
| 971 | |
| 972 | $this->end_controls_tabs(); //end normal/hover tabs/////----- |
| 973 | |
| 974 | $this->end_controls_section(); //end background control style section---------//// |
| 975 | |
| 976 | } // ==================End icon box all section snd style controls===============// |
| 977 | |
| 978 | |
| 979 | protected function render() { |
| 980 | $settings = $this->get_settings_for_display(); |
| 981 | extract( $settings ); //extract all settings array to variables converted to name of key |
| 982 | $box_title_tag = ! empty ( $settings['box_title_tag'] ) ? $settings['box_title_tag'] : 'h5'; |
| 983 | |
| 984 | //================= Template Parts =================// |
| 985 | include "templates/Icon-box/icon-box{$settings['style']}.php"; |
| 986 | |
| 987 | } |
| 988 | } |