| 1 |
<?php |
| 2 |
namespace Enteraddons\Widgets\Button; |
| 3 |
|
| 4 |
use Elementor\Widget_Base; |
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Scheme_Color; |
| 7 |
use Elementor\Scheme_Typography; |
| 8 |
use Elementor\Group_Control_Typography; |
| 9 |
use Elementor\Group_Control_Box_Shadow; |
| 10 |
use Elementor\Group_Control_Background; |
| 11 |
use Elementor\Group_Control_Border; |
| 12 |
|
| 13 |
// Exit if accessed directly |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* |
| 20 |
* Enteraddons elementor widget. |
| 21 |
* |
| 22 |
* @since 1.0 |
| 23 |
*/ |
| 24 |
|
| 25 |
class Button extends Widget_Base { |
| 26 |
|
| 27 |
public function get_name() { |
| 28 |
return 'enteraddons-button'; |
| 29 |
} |
| 30 |
|
| 31 |
public function get_title() { |
| 32 |
return esc_html__( 'Button', 'enteraddons' ); |
| 33 |
} |
| 34 |
|
| 35 |
public function get_icon() { |
| 36 |
return 'entera entera-button'; |
| 37 |
} |
| 38 |
|
| 39 |
public function get_categories() { |
| 40 |
return ['enteraddons-elements-category']; |
| 41 |
} |
| 42 |
|
| 43 |
protected function register_controls() { |
| 44 |
|
| 45 |
$repeater = new \Elementor\Repeater(); |
| 46 |
|
| 47 |
// ---------------------------------------- Button ------------------------------ |
| 48 |
$this->start_controls_section( |
| 49 |
'enteraddons_button_content', |
| 50 |
[ |
| 51 |
'label' => esc_html__( 'Button Content', 'enteraddons' ), |
| 52 |
] |
| 53 |
); |
| 54 |
$this->add_control( |
| 55 |
'btn_text', |
| 56 |
[ |
| 57 |
'label' => esc_html__( 'Button Text', 'enteraddons' ), |
| 58 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 59 |
'label_block' => true, |
| 60 |
'dynamic' => [ |
| 61 |
'active' => true, |
| 62 |
], |
| 63 |
'default' => esc_html__( 'Read More', 'enteraddons' ) |
| 64 |
] |
| 65 |
); |
| 66 |
$this->add_control( |
| 67 |
'small_text', |
| 68 |
[ |
| 69 |
'label' => esc_html__( 'Small Text', 'enteraddons' ), |
| 70 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 71 |
'dynamic' => [ |
| 72 |
'active' => true, |
| 73 |
], |
| 74 |
'label_block' => true, |
| 75 |
] |
| 76 |
); |
| 77 |
$this->add_control( |
| 78 |
'small_text_direction', |
| 79 |
[ |
| 80 |
'label' => esc_html__( 'Small Text Direction', 'enteraddons' ), |
| 81 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 82 |
'default' => 'column-reverse', |
| 83 |
'options' => [ |
| 84 |
'column' => esc_html__( 'Top', 'enteraddons' ), |
| 85 |
'row-reverse' => esc_html__( 'Right', 'enteraddons' ), |
| 86 |
'row' => esc_html__( 'Left', 'enteraddons' ), |
| 87 |
'column-reverse' => esc_html__( 'Bottom', 'enteraddons' ), |
| 88 |
], |
| 89 |
'selectors' => [ |
| 90 |
'{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link .entera-btn-text-wrap' => 'flex-direction: {{VALUE}};', |
| 91 |
], |
| 92 |
|
| 93 |
] |
| 94 |
); |
| 95 |
$this->add_control( |
| 96 |
'link', |
| 97 |
[ |
| 98 |
'label' => esc_html__( 'Link', 'enteraddons' ), |
| 99 |
'type' => \Elementor\Controls_Manager::URL, |
| 100 |
'placeholder' => esc_html__( 'https://your-link.com', 'enteraddons' ), |
| 101 |
'dynamic' => [ |
| 102 |
'active' => true, |
| 103 |
], |
| 104 |
'show_external' => true, |
| 105 |
'default' => [ |
| 106 |
'url' => '', |
| 107 |
'is_external' => true, |
| 108 |
'nofollow' => true, |
| 109 |
], |
| 110 |
] |
| 111 |
); |
| 112 |
|
| 113 |
$this->end_controls_section(); // End content |
| 114 |
|
| 115 |
// ---------------------------------------- Button ------------------------------ |
| 116 |
$this->start_controls_section( |
| 117 |
'enteraddons_button_icon_content', |
| 118 |
[ |
| 119 |
'label' => esc_html__( 'Button Icon', 'enteraddons' ), |
| 120 |
] |
| 121 |
); |
| 122 |
$this->add_control( |
| 123 |
'show_icon', |
| 124 |
[ |
| 125 |
'label' => esc_html__( 'Show Icon', 'enteraddons' ), |
| 126 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 127 |
'label_on' => esc_html__( 'Show', 'enteraddons' ), |
| 128 |
'label_off' => esc_html__( 'Hide', 'enteraddons' ), |
| 129 |
'return_value' => 'yes', |
| 130 |
'default' => 'yes', |
| 131 |
] |
| 132 |
); |
| 133 |
$this->add_control( |
| 134 |
'icon_direction', |
| 135 |
[ |
| 136 |
'label' => esc_html__( 'Icon Direction', 'enteraddons' ), |
| 137 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 138 |
'default' => 'row-reverse', |
| 139 |
'condition' => [ 'show_icon' => 'yes' ], |
| 140 |
'options' => [ |
| 141 |
'column' => esc_html__( 'Top', 'enteraddons' ), |
| 142 |
'row-reverse' => esc_html__( 'Right', 'enteraddons' ), |
| 143 |
'inherit' => esc_html__( 'Left', 'enteraddons' ), |
| 144 |
'column-reverse' => esc_html__( 'Bottom', 'enteraddons' ), |
| 145 |
], |
| 146 |
'selectors' => [ |
| 147 |
'{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link' => 'flex-direction: {{VALUE}};', |
| 148 |
], |
| 149 |
|
| 150 |
] |
| 151 |
); |
| 152 |
$this->add_control( |
| 153 |
'icon_position', |
| 154 |
[ |
| 155 |
'label' => esc_html__( 'Icon Position', 'enteraddons' ), |
| 156 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 157 |
'default' => 'left', |
| 158 |
'condition' => [ 'show_icon' => 'yes' ], |
| 159 |
'options' => [ |
| 160 |
'right' => esc_html__( 'Right', 'enteraddons' ), |
| 161 |
'left' => esc_html__( 'Left', 'enteraddons' ), |
| 162 |
] |
| 163 |
] |
| 164 |
); |
| 165 |
$this->add_control( |
| 166 |
'button_icon', |
| 167 |
[ |
| 168 |
'label' => esc_html__( 'Normal Icon/Before Text Icon', 'enteraddons' ), |
| 169 |
'type' => \Elementor\Controls_Manager::ICONS, |
| 170 |
'condition' => [ 'show_icon' => 'yes' ], |
| 171 |
'default' => [ |
| 172 |
'value' => 'fas fa-arrow-right', |
| 173 |
'library' => 'solid', |
| 174 |
] |
| 175 |
] |
| 176 |
); |
| 177 |
$this->add_control( |
| 178 |
'button_hover_icon', |
| 179 |
[ |
| 180 |
'label' => esc_html__( 'Hover Icon/After Text Icon', 'enteraddons' ), |
| 181 |
'type' => \Elementor\Controls_Manager::ICONS, |
| 182 |
'condition' => [ 'show_icon' => 'yes' ], |
| 183 |
'default' => [ |
| 184 |
'value' => 'fas fa-arrow-right', |
| 185 |
'library' => 'solid', |
| 186 |
] |
| 187 |
] |
| 188 |
); |
| 189 |
$this->end_controls_section(); // End Icon content |
| 190 |
|
| 191 |
/** |
| 192 |
* Style Tab |
| 193 |
* ------------------------------ Button Style ------------------------------ |
| 194 |
* |
| 195 |
*/ |
| 196 |
$this->start_controls_section( |
| 197 |
'enteraddons_button_content_style_settings', [ |
| 198 |
'label' => esc_html__( 'Button Style', 'enteraddons' ), |
| 199 |
'tab' => Controls_Manager::TAB_STYLE, |
| 200 |
] |
| 201 |
); |
| 202 |
|
| 203 |
$this->add_responsive_control( |
| 204 |
'btn_width', |
| 205 |
[ |
| 206 |
'label' => esc_html__( 'Button Width', 'enteraddons' ), |
| 207 |
'type' => Controls_Manager::SLIDER, |
| 208 |
'size_units' => [ 'px', '%' ], |
| 209 |
'range' => [ |
| 210 |
'px' => [ |
| 211 |
'min' => 0, |
| 212 |
'max' => 1000, |
| 213 |
'step' => 1, |
| 214 |
], |
| 215 |
'%' => [ |
| 216 |
'min' => 0, |
| 217 |
'max' => 100, |
| 218 |
], |
| 219 |
], |
| 220 |
'default' => [ |
| 221 |
'unit' => '%', |
| 222 |
'size' => '', |
| 223 |
], |
| 224 |
'selectors' => [ |
| 225 |
'{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link' => 'width: {{SIZE}}{{UNIT}} !important;', |
| 226 |
], |
| 227 |
] |
| 228 |
); |
| 229 |
$this->add_responsive_control( |
| 230 |
'btn_height', |
| 231 |
[ |
| 232 |
'label' => esc_html__( 'Button Height', 'enteraddons' ), |
| 233 |
'type' => Controls_Manager::SLIDER, |
| 234 |
'size_units' => [ 'px', '%' ], |
| 235 |
'range' => [ |
| 236 |
'px' => [ |
| 237 |
'min' => 0, |
| 238 |
'max' => 1000, |
| 239 |
'step' => 1, |
| 240 |
], |
| 241 |
'%' => [ |
| 242 |
'min' => 0, |
| 243 |
'max' => 100, |
| 244 |
], |
| 245 |
], |
| 246 |
'default' => [ |
| 247 |
'unit' => '%', |
| 248 |
'size' => '', |
| 249 |
], |
| 250 |
'selectors' => [ |
| 251 |
'{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link' => 'height: {{SIZE}}{{UNIT}};', |
| 252 |
], |
| 253 |
] |
| 254 |
); |
| 255 |
$this->add_responsive_control( |
| 256 |
'btn_alignment', |
| 257 |
[ |
| 258 |
'label' => esc_html__( 'Button Alignment', 'enteraddons' ), |
| 259 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 260 |
'options' => [ |
| 261 |
'left' => [ |
| 262 |
'title' => esc_html__( 'Left', 'enteraddons' ), |
| 263 |
'icon' => 'eicon-text-align-left', |
| 264 |
], |
| 265 |
'center' => [ |
| 266 |
'title' => esc_html__( 'Center', 'enteraddons' ), |
| 267 |
'icon' => 'eicon-text-align-center', |
| 268 |
], |
| 269 |
'right' => [ |
| 270 |
'title' => esc_html__( 'Right', 'enteraddons' ), |
| 271 |
'icon' => 'eicon-text-align-right', |
| 272 |
], |
| 273 |
], |
| 274 |
'default' => 'left', |
| 275 |
'toggle' => true, |
| 276 |
'selectors' => [ |
| 277 |
'{{WRAPPER}} .enteraddons-anchor-btn-wrap' => 'text-align:{{VALUE}};', |
| 278 |
], |
| 279 |
] |
| 280 |
); |
| 281 |
$this->add_responsive_control( |
| 282 |
'btn_text_alignment', |
| 283 |
[ |
| 284 |
'label' => esc_html__( 'Text Alignment', 'enteraddons' ), |
| 285 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 286 |
'options' => [ |
| 287 |
'left' => [ |
| 288 |
'title' => esc_html__( 'Left', 'enteraddons' ), |
| 289 |
'icon' => 'eicon-text-align-left', |
| 290 |
], |
| 291 |
'center' => [ |
| 292 |
'title' => esc_html__( 'Center', 'enteraddons' ), |
| 293 |
'icon' => 'eicon-text-align-center', |
| 294 |
], |
| 295 |
'right' => [ |
| 296 |
'title' => esc_html__( 'Right', 'enteraddons' ), |
| 297 |
'icon' => 'eicon-text-align-right', |
| 298 |
] |
| 299 |
], |
| 300 |
'default' => 'center', |
| 301 |
'toggle' => true, |
| 302 |
'selectors' => [ |
| 303 |
'{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link' => 'justify-content:{{VALUE}};', |
| 304 |
], |
| 305 |
] |
| 306 |
); |
| 307 |
$this->start_controls_tabs( 'tab_button' ); |
| 308 |
|
| 309 |
// Controls tab For Normal |
| 310 |
$this->start_controls_tab( |
| 311 |
'item_normal', |
| 312 |
[ |
| 313 |
'label' => esc_html__( 'Normal', 'enteraddons' ), |
| 314 |
] |
| 315 |
); |
| 316 |
|
| 317 |
$this->add_responsive_control( |
| 318 |
'item_margin', |
| 319 |
[ |
| 320 |
'label' => esc_html__( 'Margin', 'enteraddons' ), |
| 321 |
'type' => Controls_Manager::DIMENSIONS, |
| 322 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 323 |
'size_units' => [ 'px', '%', 'em' ], |
| 324 |
'selectors' => [ |
| 325 |
'{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 326 |
], |
| 327 |
] |
| 328 |
); |
| 329 |
$this->add_responsive_control( |
| 330 |
'item_padding', |
| 331 |
[ |
| 332 |
'label' => esc_html__( 'Padding', 'enteraddons' ), |
| 333 |
'type' => Controls_Manager::DIMENSIONS, |
| 334 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 335 |
'size_units' => [ 'px', '%', 'em' ], |
| 336 |
'selectors' => [ |
| 337 |
'{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 338 |
], |
| 339 |
] |
| 340 |
); |
| 341 |
$this->add_group_control( |
| 342 |
\Elementor\Group_Control_Border::get_type(), |
| 343 |
[ |
| 344 |
'name' => 'item_border', |
| 345 |
'label' => esc_html__( 'Border', 'enteraddons' ), |
| 346 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link', |
| 347 |
] |
| 348 |
); |
| 349 |
$this->add_responsive_control( |
| 350 |
'item_radius', |
| 351 |
[ |
| 352 |
'label' => esc_html__( 'Border Radius', 'enteraddons' ), |
| 353 |
'type' => Controls_Manager::DIMENSIONS, |
| 354 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 355 |
'size_units' => [ 'px', '%', 'em' ], |
| 356 |
'selectors' => [ |
| 357 |
'{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 358 |
], |
| 359 |
] |
| 360 |
); |
| 361 |
$this->add_group_control( |
| 362 |
\Elementor\Group_Control_Box_Shadow::get_type(), |
| 363 |
[ |
| 364 |
'name' => 'item_shadow', |
| 365 |
'label' => esc_html__( 'Box Shadow', 'enteraddons' ), |
| 366 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link', |
| 367 |
] |
| 368 |
); |
| 369 |
$this->add_group_control( |
| 370 |
\Elementor\Group_Control_Background::get_type(), |
| 371 |
[ |
| 372 |
'name' => 'item_background', |
| 373 |
'label' => esc_html__( 'Background', 'enteraddons' ), |
| 374 |
'types' => [ 'classic', 'gradient' ], |
| 375 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link', |
| 376 |
] |
| 377 |
); |
| 378 |
|
| 379 |
$this->end_controls_tab(); // End Controls tab |
| 380 |
|
| 381 |
// Controls tab For Hover |
| 382 |
$this->start_controls_tab( |
| 383 |
'item_hover', |
| 384 |
[ |
| 385 |
'label' => esc_html__( 'Hover', 'enteraddons' ), |
| 386 |
] |
| 387 |
); |
| 388 |
$this->add_group_control( |
| 389 |
\Elementor\Group_Control_Border::get_type(), |
| 390 |
[ |
| 391 |
'name' => 'item_hover_border', |
| 392 |
'label' => esc_html__( 'Border', 'enteraddons' ), |
| 393 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link:hover', |
| 394 |
] |
| 395 |
); |
| 396 |
$this->add_responsive_control( |
| 397 |
'item_hover_radius', |
| 398 |
[ |
| 399 |
'label' => esc_html__( 'Border Radius', 'enteraddons' ), |
| 400 |
'type' => Controls_Manager::DIMENSIONS, |
| 401 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 402 |
'size_units' => [ 'px', '%', 'em' ], |
| 403 |
'selectors' => [ |
| 404 |
'{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 405 |
], |
| 406 |
] |
| 407 |
); |
| 408 |
$this->add_group_control( |
| 409 |
\Elementor\Group_Control_Box_Shadow::get_type(), |
| 410 |
[ |
| 411 |
'name' => 'item_hover_shadow', |
| 412 |
'label' => esc_html__( 'Box Shadow', 'enteraddons' ), |
| 413 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link:hover', |
| 414 |
] |
| 415 |
); |
| 416 |
$this->add_group_control( |
| 417 |
\Elementor\Group_Control_Background::get_type(), |
| 418 |
[ |
| 419 |
'name' => 'item_hover_background', |
| 420 |
'label' => esc_html__( 'Background', 'enteraddons' ), |
| 421 |
'types' => [ 'classic', 'gradient' ], |
| 422 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-btn-wrap .enteraddons-anchor-link:hover', |
| 423 |
] |
| 424 |
); |
| 425 |
|
| 426 |
|
| 427 |
$this->end_controls_tab(); // End Controls tab |
| 428 |
|
| 429 |
$this->end_controls_tabs(); // end controls tabs section |
| 430 |
|
| 431 |
$this->end_controls_section(); |
| 432 |
|
| 433 |
/** |
| 434 |
* Style Tab |
| 435 |
* ------------------------------ Button Text Style ------------------------------ |
| 436 |
* |
| 437 |
*/ |
| 438 |
$this->start_controls_section( |
| 439 |
'enteraddons_button_text_content_style_settings', [ |
| 440 |
'label' => esc_html__( 'Button Text Style', 'enteraddons' ), |
| 441 |
'tab' => Controls_Manager::TAB_STYLE, |
| 442 |
] |
| 443 |
); |
| 444 |
$this->add_group_control( |
| 445 |
\Elementor\Group_Control_Typography::get_type(), |
| 446 |
[ |
| 447 |
'name' => 'text_typography', |
| 448 |
'label' => esc_html__( 'Typography', 'enteraddons' ), |
| 449 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-link .btn-min-text', |
| 450 |
] |
| 451 |
); |
| 452 |
|
| 453 |
$this->start_controls_tabs( 'tab_text_button' ); |
| 454 |
|
| 455 |
// Controls tab For Normal |
| 456 |
$this->start_controls_tab( |
| 457 |
'item_text_normal', |
| 458 |
[ |
| 459 |
'label' => esc_html__( 'Normal', 'enteraddons' ), |
| 460 |
] |
| 461 |
); |
| 462 |
$this->add_control( |
| 463 |
'text_color', |
| 464 |
[ |
| 465 |
'label' => esc_html__( 'Text Color', 'enteraddons' ), |
| 466 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 467 |
'selectors' => [ |
| 468 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-min-text' => 'color: {{VALUE}}', |
| 469 |
], |
| 470 |
] |
| 471 |
); |
| 472 |
$this->add_responsive_control( |
| 473 |
'text_margin', |
| 474 |
[ |
| 475 |
'label' => esc_html__( 'Margin', 'enteraddons' ), |
| 476 |
'type' => Controls_Manager::DIMENSIONS, |
| 477 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 478 |
'size_units' => [ 'px', '%', 'em' ], |
| 479 |
'selectors' => [ |
| 480 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-min-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 481 |
], |
| 482 |
] |
| 483 |
); |
| 484 |
$this->add_responsive_control( |
| 485 |
'text_padding', |
| 486 |
[ |
| 487 |
'label' => esc_html__( 'Padding', 'enteraddons' ), |
| 488 |
'type' => Controls_Manager::DIMENSIONS, |
| 489 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 490 |
'size_units' => [ 'px', '%', 'em' ], |
| 491 |
'selectors' => [ |
| 492 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-min-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 493 |
], |
| 494 |
] |
| 495 |
); |
| 496 |
|
| 497 |
$this->end_controls_tab(); // End Controls tab |
| 498 |
|
| 499 |
// Controls tab For Hover |
| 500 |
$this->start_controls_tab( |
| 501 |
'text_hover', |
| 502 |
[ |
| 503 |
'label' => esc_html__( 'Hover', 'enteraddons' ), |
| 504 |
] |
| 505 |
); |
| 506 |
$this->add_control( |
| 507 |
'hover_text_color', |
| 508 |
[ |
| 509 |
'label' => esc_html__( 'Hover Text Color', 'enteraddons' ), |
| 510 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 511 |
'selectors' => [ |
| 512 |
'{{WRAPPER}} .enteraddons-anchor-link:hover .btn-min-text' => 'color: {{VALUE}}', |
| 513 |
], |
| 514 |
] |
| 515 |
); |
| 516 |
$this->end_controls_tab(); // End Controls tab |
| 517 |
|
| 518 |
$this->end_controls_tabs(); // end controls tabs section |
| 519 |
$this->end_controls_section(); |
| 520 |
|
| 521 |
/** |
| 522 |
* Style Tab |
| 523 |
* ------------------------------ Button Small Text Style ------------------------------ |
| 524 |
* |
| 525 |
*/ |
| 526 |
$this->start_controls_section( |
| 527 |
'enteraddons_button_small_text_content_style_settings', [ |
| 528 |
'label' => esc_html__( 'Button Small Text Style', 'enteraddons' ), |
| 529 |
'tab' => Controls_Manager::TAB_STYLE, |
| 530 |
] |
| 531 |
); |
| 532 |
$this->add_responsive_control( |
| 533 |
'small_btn_text_alignment', |
| 534 |
[ |
| 535 |
'label' => esc_html__( 'Text Alignment', 'enteraddons' ), |
| 536 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 537 |
'options' => [ |
| 538 |
'flex-start' => [ |
| 539 |
'title' => esc_html__( 'Left', 'enteraddons' ), |
| 540 |
'icon' => 'eicon-text-align-left', |
| 541 |
], |
| 542 |
'center' => [ |
| 543 |
'title' => esc_html__( 'Center', 'enteraddons' ), |
| 544 |
'icon' => 'eicon-text-align-center', |
| 545 |
], |
| 546 |
'flex-end' => [ |
| 547 |
'title' => esc_html__( 'Right', 'enteraddons' ), |
| 548 |
'icon' => 'eicon-text-align-right', |
| 549 |
] |
| 550 |
], |
| 551 |
'default' => 'center', |
| 552 |
'toggle' => true, |
| 553 |
'selectors' => [ |
| 554 |
'{{WRAPPER}} .enteraddons-anchor-btn-wrap .entera-btn-text-wrap' => 'align-items:{{VALUE}};', |
| 555 |
], |
| 556 |
'condition' => [ 'small_text_direction' => ['column-reverse', 'column'] ] |
| 557 |
] |
| 558 |
); |
| 559 |
$this->add_group_control( |
| 560 |
\Elementor\Group_Control_Typography::get_type(), |
| 561 |
[ |
| 562 |
'name' => 'small_text_typography', |
| 563 |
'label' => esc_html__( 'Typography', 'enteraddons' ), |
| 564 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-link .btn-small-text', |
| 565 |
] |
| 566 |
); |
| 567 |
|
| 568 |
$this->start_controls_tabs( 'tab_small_text_button' ); |
| 569 |
|
| 570 |
// Controls tab For Normal |
| 571 |
$this->start_controls_tab( |
| 572 |
'small_text_normal', |
| 573 |
[ |
| 574 |
'label' => esc_html__( 'Normal', 'enteraddons' ), |
| 575 |
] |
| 576 |
); |
| 577 |
$this->add_control( |
| 578 |
'small_text_color', |
| 579 |
[ |
| 580 |
'label' => esc_html__( 'Text Color', 'enteraddons' ), |
| 581 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 582 |
'selectors' => [ |
| 583 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-small-text' => 'color: {{VALUE}}', |
| 584 |
], |
| 585 |
] |
| 586 |
); |
| 587 |
$this->add_responsive_control( |
| 588 |
'small_text_margin', |
| 589 |
[ |
| 590 |
'label' => esc_html__( 'Margin', 'enteraddons' ), |
| 591 |
'type' => Controls_Manager::DIMENSIONS, |
| 592 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 593 |
'size_units' => [ 'px', '%', 'em' ], |
| 594 |
'selectors' => [ |
| 595 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-small-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 596 |
], |
| 597 |
] |
| 598 |
); |
| 599 |
$this->add_responsive_control( |
| 600 |
'small_text_padding', |
| 601 |
[ |
| 602 |
'label' => esc_html__( 'Padding', 'enteraddons' ), |
| 603 |
'type' => Controls_Manager::DIMENSIONS, |
| 604 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 605 |
'size_units' => [ 'px', '%', 'em' ], |
| 606 |
'selectors' => [ |
| 607 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-small-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 608 |
], |
| 609 |
] |
| 610 |
); |
| 611 |
|
| 612 |
$this->end_controls_tab(); // End Controls tab |
| 613 |
|
| 614 |
// Controls tab For Hover |
| 615 |
$this->start_controls_tab( |
| 616 |
'small_text_hover', |
| 617 |
[ |
| 618 |
'label' => esc_html__( 'Hover', 'enteraddons' ), |
| 619 |
] |
| 620 |
); |
| 621 |
$this->add_control( |
| 622 |
'hover_small_text_color', |
| 623 |
[ |
| 624 |
'label' => esc_html__( 'Hover Text Color', 'enteraddons' ), |
| 625 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 626 |
'selectors' => [ |
| 627 |
'{{WRAPPER}} .enteraddons-anchor-link:hover .btn-small-text' => 'color: {{VALUE}}', |
| 628 |
], |
| 629 |
] |
| 630 |
); |
| 631 |
$this->end_controls_tab(); // End Controls tab |
| 632 |
|
| 633 |
$this->end_controls_tabs(); // end controls tabs section |
| 634 |
$this->end_controls_section(); |
| 635 |
/** |
| 636 |
* Style Tab |
| 637 |
* ------------------------------ Icon Style Settings ------------------------------ |
| 638 |
* |
| 639 |
*/ |
| 640 |
$this->start_controls_section( |
| 641 |
'enteraddons_btn_icon_settings', [ |
| 642 |
'label' => esc_html__( 'Icon', 'enteraddons' ), |
| 643 |
'tab' => Controls_Manager::TAB_STYLE, |
| 644 |
] |
| 645 |
); |
| 646 |
$this->start_controls_tabs( 'tab_btn_icon' ); |
| 647 |
// Controls tab For Normal |
| 648 |
$this->start_controls_tab( |
| 649 |
'icon_normal', |
| 650 |
[ |
| 651 |
'label' => esc_html__( 'Normal', 'enteraddons' ), |
| 652 |
] |
| 653 |
); |
| 654 |
$this->add_control( |
| 655 |
'icon_color', |
| 656 |
[ |
| 657 |
'label' => esc_html__( 'Icon Color', 'enteraddons' ), |
| 658 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 659 |
'selectors' => [ |
| 660 |
'{{WRAPPER}} .btn-icons .btn--normal-icon i' => 'color: {{VALUE}}', |
| 661 |
], |
| 662 |
] |
| 663 |
); |
| 664 |
$this->add_responsive_control( |
| 665 |
'icon_size', |
| 666 |
[ |
| 667 |
'label' => esc_html__( 'Icon Size', 'enteraddons' ), |
| 668 |
'type' => Controls_Manager::SLIDER, |
| 669 |
'size_units' => [ 'px', '%' ], |
| 670 |
'range' => [ |
| 671 |
'px' => [ |
| 672 |
'min' => 0, |
| 673 |
'max' => 1000, |
| 674 |
'step' => 1, |
| 675 |
], |
| 676 |
'%' => [ |
| 677 |
'min' => 0, |
| 678 |
'max' => 100, |
| 679 |
], |
| 680 |
], |
| 681 |
'default' => [ |
| 682 |
'unit' => '%', |
| 683 |
'size' => '', |
| 684 |
], |
| 685 |
'selectors' => [ |
| 686 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-icons i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 687 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-icons img' => 'width: {{SIZE}}{{UNIT}};', |
| 688 |
], |
| 689 |
] |
| 690 |
); |
| 691 |
$this->add_responsive_control( |
| 692 |
'icon_width', |
| 693 |
[ |
| 694 |
'label' => esc_html__( 'Icon Container Width', 'enteraddons' ), |
| 695 |
'type' => Controls_Manager::SLIDER, |
| 696 |
'size_units' => [ 'px', '%' ], |
| 697 |
'range' => [ |
| 698 |
'px' => [ |
| 699 |
'min' => 0, |
| 700 |
'max' => 1000, |
| 701 |
'step' => 1, |
| 702 |
], |
| 703 |
'%' => [ |
| 704 |
'min' => 0, |
| 705 |
'max' => 100, |
| 706 |
], |
| 707 |
], |
| 708 |
'default' => [ |
| 709 |
'unit' => '%', |
| 710 |
'size' => '', |
| 711 |
], |
| 712 |
'selectors' => [ |
| 713 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-icons' => 'width: {{SIZE}}{{UNIT}};', |
| 714 |
], |
| 715 |
] |
| 716 |
); |
| 717 |
$this->add_responsive_control( |
| 718 |
'icon_height', |
| 719 |
[ |
| 720 |
'label' => esc_html__( 'Icon Container Height', 'enteraddons' ), |
| 721 |
'type' => Controls_Manager::SLIDER, |
| 722 |
'size_units' => [ 'px', '%' ], |
| 723 |
'range' => [ |
| 724 |
'px' => [ |
| 725 |
'min' => 0, |
| 726 |
'max' => 1000, |
| 727 |
'step' => 1, |
| 728 |
], |
| 729 |
'%' => [ |
| 730 |
'min' => 0, |
| 731 |
'max' => 100, |
| 732 |
], |
| 733 |
], |
| 734 |
'default' => [ |
| 735 |
'unit' => '%', |
| 736 |
'size' => '', |
| 737 |
], |
| 738 |
'selectors' => [ |
| 739 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-icons' => 'height: {{SIZE}}{{UNIT}};', |
| 740 |
], |
| 741 |
] |
| 742 |
); |
| 743 |
$this->add_responsive_control( |
| 744 |
'icon_margin', |
| 745 |
[ |
| 746 |
'label' => esc_html__( 'Margin', 'enteraddons' ), |
| 747 |
'type' => Controls_Manager::DIMENSIONS, |
| 748 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 749 |
'size_units' => [ 'px', '%', 'em' ], |
| 750 |
'selectors' => [ |
| 751 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-icons' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 752 |
], |
| 753 |
] |
| 754 |
); |
| 755 |
|
| 756 |
$this->add_responsive_control( |
| 757 |
'icon_padding', |
| 758 |
[ |
| 759 |
'label' => esc_html__( 'Padding', 'enteraddons' ), |
| 760 |
'type' => Controls_Manager::DIMENSIONS, |
| 761 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 762 |
'size_units' => [ 'px', '%', 'em' ], |
| 763 |
'selectors' => [ |
| 764 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-icons' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 765 |
], |
| 766 |
] |
| 767 |
); |
| 768 |
$this->add_group_control( |
| 769 |
\Elementor\Group_Control_Border::get_type(), |
| 770 |
[ |
| 771 |
'name' => 'icon_border', |
| 772 |
'label' => esc_html__( 'Border', 'enteraddons' ), |
| 773 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-link .btn-icons', |
| 774 |
] |
| 775 |
); |
| 776 |
$this->add_responsive_control( |
| 777 |
'icon_border_radius', |
| 778 |
[ |
| 779 |
'label' => esc_html__( 'Border Radius', 'enteraddons' ), |
| 780 |
'type' => Controls_Manager::DIMENSIONS, |
| 781 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 782 |
'size_units' => [ 'px', '%', 'em' ], |
| 783 |
'selectors' => [ |
| 784 |
'{{WRAPPER}} .enteraddons-anchor-link .btn-icons' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 785 |
], |
| 786 |
] |
| 787 |
); |
| 788 |
$this->add_group_control( |
| 789 |
\Elementor\Group_Control_Box_Shadow::get_type(), |
| 790 |
[ |
| 791 |
'name' => 'icon_box_shadow', |
| 792 |
'label' => esc_html__( 'Box Shadow', 'enteraddons' ), |
| 793 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-link .btn-icons', |
| 794 |
] |
| 795 |
); |
| 796 |
$this->add_group_control( |
| 797 |
\Elementor\Group_Control_Background::get_type(), |
| 798 |
[ |
| 799 |
'name' => 'background', |
| 800 |
'label' => esc_html__( 'Background', 'enteraddons' ), |
| 801 |
'types' => [ 'classic', 'gradient' ], |
| 802 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-link .btn-icons', |
| 803 |
] |
| 804 |
); |
| 805 |
|
| 806 |
$this->end_controls_tab(); // End Controls tab |
| 807 |
|
| 808 |
// Controls tab For Hover |
| 809 |
$this->start_controls_tab( |
| 810 |
'icon_hover', |
| 811 |
[ |
| 812 |
'label' => esc_html__( 'Hover', 'enteraddons' ), |
| 813 |
] |
| 814 |
); |
| 815 |
$this->add_control( |
| 816 |
'icon_hover_color', |
| 817 |
[ |
| 818 |
'label' => esc_html__( 'Icon Color', 'enteraddons' ), |
| 819 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 820 |
'selectors' => [ |
| 821 |
'{{WRAPPER}} .enteraddons-anchor-link:hover .btn-icons i' => 'color: {{VALUE}}', |
| 822 |
], |
| 823 |
] |
| 824 |
); |
| 825 |
$this->add_group_control( |
| 826 |
\Elementor\Group_Control_Background::get_type(), |
| 827 |
[ |
| 828 |
'name' => 'icon_hover_background', |
| 829 |
'label' => esc_html__( 'Background', 'enteraddons' ), |
| 830 |
'types' => [ 'classic', 'gradient' ], |
| 831 |
'selector' => '{{WRAPPER}} .enteraddons-anchor-link:hover .btn-icons', |
| 832 |
] |
| 833 |
); |
| 834 |
$this->end_controls_tab(); // End Controls tab |
| 835 |
|
| 836 |
$this->end_controls_tabs(); // end controls tabs section |
| 837 |
$this->end_controls_section(); |
| 838 |
|
| 839 |
/** |
| 840 |
* Style Tab |
| 841 |
* ------------------------------ Hover Effect Style Settings ------------------------------ |
| 842 |
* |
| 843 |
*/ |
| 844 |
$this->start_controls_section( |
| 845 |
'enteraddons_btn_hover_effect_settings', [ |
| 846 |
'label' => esc_html__( 'Hover Effect', 'enteraddons' ), |
| 847 |
'tab' => Controls_Manager::TAB_STYLE, |
| 848 |
] |
| 849 |
); |
| 850 |
$this->add_control( |
| 851 |
'btn_hover_effect', |
| 852 |
[ |
| 853 |
'label' => esc_html__( 'Hover Effect', 'enteraddons' ), |
| 854 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 855 |
'default' => 'hover-effect-normal', |
| 856 |
'options' => [ |
| 857 |
'hover-effect-normal' => esc_html__( 'Normal', 'enteraddons' ), |
| 858 |
'hover-border-btm-effect' => esc_html__( 'Border Bottom Effect', 'enteraddons' ), |
| 859 |
'hover-saclup-effect' => esc_html__( 'Saclup Effect', 'enteraddons' ), |
| 860 |
'dual-bg-effect' => esc_html__( 'Dual Background Effect', 'enteraddons' ), |
| 861 |
'interactive-bg' => esc_html__( 'Interactive Background', 'enteraddons' ), |
| 862 |
'dual-icon-btn' => esc_html__( 'Dual Icon Btn', 'enteraddons' ) |
| 863 |
], |
| 864 |
] |
| 865 |
); |
| 866 |
$this->add_group_control( |
| 867 |
\Elementor\Group_Control_Background::get_type(), |
| 868 |
[ |
| 869 |
'name' => 'btn_hover_effect_background', |
| 870 |
'label' => esc_html__( 'Background', 'enteraddons' ), |
| 871 |
'types' => [ 'classic', 'gradient' ], |
| 872 |
'selector' => '{{WRAPPER}} .dual-bg-effect:before,{{WRAPPER}} .dual-bg-effect:after,{{WRAPPER}} .interactive-bg:after,.hover-border-btm-effect:after', |
| 873 |
'condition' => [ 'btn_hover_effect' => ['interactive-bg', 'dual-bg-effect','hover-border-btm-effect'] ] |
| 874 |
] |
| 875 |
); |
| 876 |
$this->end_controls_section(); |
| 877 |
|
| 878 |
|
| 879 |
} |
| 880 |
|
| 881 |
protected function render() { |
| 882 |
|
| 883 |
// get settings |
| 884 |
$settings = $this->get_settings_for_display(); |
| 885 |
|
| 886 |
// Template render |
| 887 |
$obj = new \Enteraddons\Widgets\Button\Button_Template(); |
| 888 |
$obj::setDisplaySettings( $settings ); |
| 889 |
$obj->renderTemplate(); |
| 890 |
} |
| 891 |
|
| 892 |
public function get_style_depends() { |
| 893 |
return [ 'enteraddons-global-style' ]; |
| 894 |
} |
| 895 |
|
| 896 |
|
| 897 |
} |
| 898 |
|