| 1 |
<?php |
| 2 |
|
| 3 |
namespace MasterAddons\Addons; |
| 4 |
|
| 5 |
use MasterAddons\Inc\Classes\Base\Master_Widget; |
| 6 |
use \Elementor\Controls_Stack; |
| 7 |
use \Elementor\Controls_Manager as Controls_Manager; |
| 8 |
use \Elementor\Group_Control_Border as Group_Control_Border; |
| 9 |
use \Elementor\Group_Control_Box_Shadow as Group_Control_Box_Shadow; |
| 10 |
use \Elementor\Group_Control_Typography as Group_Control_Typography; |
| 11 |
use \Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 12 |
use MasterAddons\Inc\Classes\Helper; |
| 13 |
use MasterAddons\Inc\Admin\Config; |
| 14 |
|
| 15 |
/** |
| 16 |
* Author Name: Liton Arefin |
| 17 |
* Author URL : https: //jeweltheme.com |
| 18 |
* Date : 6/25/19 |
| 19 |
*/ |
| 20 |
|
| 21 |
if (!defined('ABSPATH')) exit; // If this file is called directly, abort. |
| 22 |
|
| 23 |
class Creative_Button extends Master_Widget |
| 24 |
{ |
| 25 |
use \MasterAddons\Inc\Traits\Widget_Notice; |
| 26 |
use \MasterAddons\Inc\Traits\Widget_Assets_Trait; |
| 27 |
|
| 28 |
public function get_name() |
| 29 |
{ |
| 30 |
return 'ma-creative-buttons'; |
| 31 |
} |
| 32 |
|
| 33 |
public function get_title() |
| 34 |
{ |
| 35 |
return esc_html__('Creative Buttons', 'master-addons' ); |
| 36 |
} |
| 37 |
|
| 38 |
public function get_icon() |
| 39 |
{ |
| 40 |
return 'jltma-icon ' . Config::get_addon_icon($this->get_name()); |
| 41 |
} |
| 42 |
|
| 43 |
protected function register_controls() |
| 44 |
{ |
| 45 |
|
| 46 |
$this->start_controls_section( |
| 47 |
'ma_el_creative_button_content_style_presets', |
| 48 |
[ |
| 49 |
'label' => esc_html__('Button Preset & Controls', 'master-addons' ) |
| 50 |
] |
| 51 |
); |
| 52 |
|
| 53 |
// Define default free options - Pro version overrides via filter |
| 54 |
$button_effect_options = apply_filters('master_addons/addons/creative_buttons/button_effect', [ |
| 55 |
'jltma-creative-button--default' => esc_html__('Default', 'master-addons'), |
| 56 |
'jltma-creative-button--winona' => esc_html__('Winona', 'master-addons'), |
| 57 |
'jltma-creative-button--ujarak' => esc_html__('Ujarak', 'master-addons'), |
| 58 |
'jltma-creative-button--wayra' => esc_html__('Wayra', 'master-addons'), |
| 59 |
'jltma-creative-button--tamaya' => esc_html__('Tamaya', 'master-addons'), |
| 60 |
'jltma-creative-button--rayen' => esc_html__('Rayen', 'master-addons'), |
| 61 |
'jltma-creative-button--pro-1' => esc_html__('Pipaluk (Pro)', 'master-addons'), |
| 62 |
'jltma-creative-button--pro-2' => esc_html__('Moema (Pro)', 'master-addons'), |
| 63 |
'jltma-creative-button--pro-3' => esc_html__('Isi (Pro)', 'master-addons'), |
| 64 |
'jltma-creative-button--pro-4' => esc_html__('Aylen (Pro)', 'master-addons'), |
| 65 |
'jltma-creative-button--pro-5' => esc_html__('Saqui (Pro)', 'master-addons'), |
| 66 |
'jltma-creative-button--pro-6' => esc_html__('Wapasha (Pro)', 'master-addons'), |
| 67 |
'jltma-creative-button--pro-7' => esc_html__('Nina (Pro)', 'master-addons'), |
| 68 |
'jltma-creative-button--pro-8' => esc_html__('Nanuk (Pro)', 'master-addons'), |
| 69 |
'jltma-creative-button--pro-9' => esc_html__('Nuka (Pro)', 'master-addons'), |
| 70 |
'jltma-creative-button--pro-10' => esc_html__('Antiman (Pro)', 'master-addons'), |
| 71 |
'jltma-creative-button--pro-11' => esc_html__('Itzel (Pro)', 'master-addons'), |
| 72 |
'jltma-creative-button--pro-12' => esc_html__('Naira (Pro)', 'master-addons'), |
| 73 |
'jltma-creative-button--pro-13' => esc_html__('Quidel (Pro)', 'master-addons'), |
| 74 |
'jltma-creative-button--pro-14' => esc_html__('Sacnite (Pro)', 'master-addons'), |
| 75 |
'jltma-creative-button--pro-15' => esc_html__('Shikoba (Pro)', 'master-addons'), |
| 76 |
]); |
| 77 |
|
| 78 |
$this->add_control( |
| 79 |
'creative_button_effect', |
| 80 |
[ |
| 81 |
'label' => esc_html__('Button Effects', 'master-addons'), |
| 82 |
'type' => Controls_Manager::SELECT, |
| 83 |
'default' => 'jltma-creative-button--default', |
| 84 |
'options' => $button_effect_options, |
| 85 |
'description' => Helper::upgrade_to_pro('15+ more Variations on'), |
| 86 |
] |
| 87 |
); |
| 88 |
|
| 89 |
$this->add_responsive_control( |
| 90 |
'ma_el_creative_button_alignment', |
| 91 |
[ |
| 92 |
'label' => esc_html__('Button Alignment', 'master-addons' ), |
| 93 |
'type' => Controls_Manager::CHOOSE, |
| 94 |
'label_block' => false, |
| 95 |
'options' => Helper::jltma_content_alignment(), |
| 96 |
'default' => '', |
| 97 |
'selectors' => [ |
| 98 |
'{{WRAPPER}} .jltma-creative-button-wrapper' => 'justify-content: {{VALUE}};', |
| 99 |
], |
| 100 |
] |
| 101 |
); |
| 102 |
|
| 103 |
$this->add_responsive_control( |
| 104 |
'ma_el_creative_button_text_alignment', |
| 105 |
[ |
| 106 |
'label' => esc_html__('Button Text Alignment', 'master-addons' ), |
| 107 |
'type' => Controls_Manager::CHOOSE, |
| 108 |
'label_block' => false, |
| 109 |
'options' => [ |
| 110 |
'left' => [ |
| 111 |
'title' => esc_html__('Left', 'master-addons' ), |
| 112 |
'icon' => 'eicon-text-align-left', |
| 113 |
], |
| 114 |
'center' => [ |
| 115 |
'title' => esc_html__('Center', 'master-addons' ), |
| 116 |
'icon' => 'eicon-text-align-center', |
| 117 |
], |
| 118 |
'right' => [ |
| 119 |
'title' => esc_html__('Right', 'master-addons' ), |
| 120 |
'icon' => 'eicon-text-align-right', |
| 121 |
], |
| 122 |
], |
| 123 |
'default' => 'center', |
| 124 |
'selectors' => [ |
| 125 |
'{{WRAPPER}} .jltma-creative-button' => 'text-align: {{VALUE}}; justify-content: {{VALUE}};', |
| 126 |
], |
| 127 |
] |
| 128 |
); |
| 129 |
|
| 130 |
// counterup icon style |
| 131 |
$this->add_control( |
| 132 |
'ma_el_creative_button_heading', |
| 133 |
[ |
| 134 |
'label' => esc_html__('Button Controls', 'master-addons' ), |
| 135 |
'type' => Controls_Manager::HEADING, |
| 136 |
'separator' => 'after', |
| 137 |
] |
| 138 |
); |
| 139 |
|
| 140 |
|
| 141 |
$this->add_control( |
| 142 |
'creative_button_text', |
| 143 |
[ |
| 144 |
'label' => esc_html__('Button Text', 'master-addons' ), |
| 145 |
'type' => Controls_Manager::TEXT, |
| 146 |
'label_block' => true, |
| 147 |
'default' => 'Click Here ', |
| 148 |
'placeholder' => esc_html__('Enter button text', 'master-addons' ), |
| 149 |
'title' => esc_html__('Enter button text here', 'master-addons' ), |
| 150 |
] |
| 151 |
); |
| 152 |
|
| 153 |
$this->add_control( |
| 154 |
'creative_alternative_button_text', |
| 155 |
[ |
| 156 |
'label' => esc_html__('Alternative Button Text', 'master-addons' ), |
| 157 |
'type' => Controls_Manager::TEXT, |
| 158 |
'label_block' => true, |
| 159 |
'default' => 'Go!', |
| 160 |
'placeholder' => esc_html__('Enter Alternative Button text', 'master-addons' ), |
| 161 |
'title' => esc_html__('Enter Alternative Button text here', 'master-addons' ), |
| 162 |
'condition' => array( |
| 163 |
'creative_button_effect!' => 'jltma-creative-button--default' |
| 164 |
), |
| 165 |
] |
| 166 |
); |
| 167 |
|
| 168 |
$this->add_control( |
| 169 |
'creative_button_link_url', |
| 170 |
[ |
| 171 |
'label' => esc_html__('Link URL', 'master-addons' ), |
| 172 |
'type' => Controls_Manager::URL, |
| 173 |
'label_block' => true, |
| 174 |
'default' => [ |
| 175 |
'url' => '#', |
| 176 |
'is_external' => '', |
| 177 |
], |
| 178 |
'show_external' => true, |
| 179 |
] |
| 180 |
); |
| 181 |
|
| 182 |
$this->add_control( |
| 183 |
'ma_el_creative_button_icon', |
| 184 |
[ |
| 185 |
'label' => esc_html__('Icon', 'master-addons' ), |
| 186 |
'description' => esc_html__('Please choose an icon from the list.', 'master-addons' ), |
| 187 |
'type' => Controls_Manager::ICONS, |
| 188 |
'default' => [ |
| 189 |
'value' => 'eicon-editor-external-link', |
| 190 |
'library' => 'eicon', |
| 191 |
], |
| 192 |
'render_type' => 'template' |
| 193 |
] |
| 194 |
); |
| 195 |
|
| 196 |
$this->add_control( |
| 197 |
'ma_el_creative_button_icon_alignment', |
| 198 |
[ |
| 199 |
'label' => esc_html__('Icon Position', 'master-addons' ), |
| 200 |
'type' => Controls_Manager::CHOOSE, |
| 201 |
'default' => 'right', |
| 202 |
'options' => [ |
| 203 |
'left' => [ |
| 204 |
'title' => esc_html__('Before', 'master-addons' ), |
| 205 |
'icon' => 'eicon-h-align-left', |
| 206 |
], |
| 207 |
'right' => [ |
| 208 |
'title' => esc_html__('After', 'master-addons' ), |
| 209 |
'icon' => 'eicon-h-align-right', |
| 210 |
], |
| 211 |
], |
| 212 |
'toggle' => false, |
| 213 |
'condition' => [ |
| 214 |
'ma_el_creative_button_icon[value]!' => '', |
| 215 |
], |
| 216 |
] |
| 217 |
); |
| 218 |
|
| 219 |
$this->add_control( |
| 220 |
'ma_el_creative_button_icon_indent', |
| 221 |
[ |
| 222 |
'label' => esc_html__('Icon Spacing', 'master-addons' ), |
| 223 |
'type' => Controls_Manager::SLIDER, |
| 224 |
'range' => [ |
| 225 |
'px' => [ |
| 226 |
'max' => 60, |
| 227 |
], |
| 228 |
], |
| 229 |
'default' => [ |
| 230 |
'size' => 5, |
| 231 |
'unit' => 'px', |
| 232 |
], |
| 233 |
'condition' => [ |
| 234 |
'ma_el_creative_button_icon[value]!' => '', |
| 235 |
], |
| 236 |
'selectors' => [ |
| 237 |
'{{WRAPPER}} .jltma-creative-button-icon-right' => 'margin-left: {{SIZE}}px;', |
| 238 |
'{{WRAPPER}} .jltma-creative-button-icon-left' => 'margin-right: {{SIZE}}px;', |
| 239 |
'{{WRAPPER}} .jltma-creative-button--shikoba i' => 'left: -{{SIZE}}px;', |
| 240 |
], |
| 241 |
] |
| 242 |
); |
| 243 |
|
| 244 |
|
| 245 |
$this->end_controls_section(); |
| 246 |
|
| 247 |
// Help Docs section (links from config.php) |
| 248 |
$this->jltma_help_docs(); |
| 249 |
|
| 250 |
$this->upgrade_to_pro_message(); |
| 251 |
|
| 252 |
/* |
| 253 |
* Master Addons: Style Controls |
| 254 |
*/ |
| 255 |
$this->start_controls_section( |
| 256 |
'ma_el_creative_button_settings', |
| 257 |
[ |
| 258 |
'label' => esc_html__('Button Styles', 'master-addons' ), |
| 259 |
'tab' => Controls_Manager::TAB_STYLE |
| 260 |
] |
| 261 |
); |
| 262 |
|
| 263 |
$this->add_responsive_control( |
| 264 |
'ma_el_creative_button_width', |
| 265 |
[ |
| 266 |
'label' => esc_html__('Width', 'master-addons' ), |
| 267 |
'type' => Controls_Manager::SLIDER, |
| 268 |
'size_units' => ['px', '%'], |
| 269 |
'range' => [ |
| 270 |
'px' => [ |
| 271 |
'min' => 0, |
| 272 |
'max' => 500, |
| 273 |
'step' => 1, |
| 274 |
], |
| 275 |
'%' => [ |
| 276 |
'min' => 0, |
| 277 |
'max' => 100, |
| 278 |
], |
| 279 |
], |
| 280 |
'selectors' => [ |
| 281 |
'{{WRAPPER}} .jltma-creative-button' => 'width: {{SIZE}}{{UNIT}};', |
| 282 |
], |
| 283 |
] |
| 284 |
); |
| 285 |
|
| 286 |
$this->add_group_control( |
| 287 |
Group_Control_Typography::get_type(), |
| 288 |
[ |
| 289 |
'name' => 'ma_el_creative_button_typography', |
| 290 |
'global' => [ |
| 291 |
'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 292 |
], |
| 293 |
'selector' => '{{WRAPPER}} .jltma-creative-button', |
| 294 |
] |
| 295 |
); |
| 296 |
|
| 297 |
$this->add_responsive_control( |
| 298 |
'ma_el_creative_button_padding', |
| 299 |
[ |
| 300 |
'label' => esc_html__('Button Padding', 'master-addons' ), |
| 301 |
'type' => Controls_Manager::DIMENSIONS, |
| 302 |
'size_units' => ['px', 'em', '%'], |
| 303 |
'selectors' => [ |
| 304 |
'{{WRAPPER}} .jltma-creative-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 305 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--winona::after' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 306 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--tamaya::before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 307 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--rayen::before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 308 |
// '{{WRAPPER}} .jltma-creative-button.jltma-creative-button--rayen > span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 309 |
], |
| 310 |
] |
| 311 |
); |
| 312 |
|
| 313 |
$this->add_group_control( |
| 314 |
Group_Control_Border::get_type(), |
| 315 |
[ |
| 316 |
'name' => 'ma_el_creative_button_border', |
| 317 |
'selector' => '{{WRAPPER}} .jltma-creative-button', |
| 318 |
] |
| 319 |
); |
| 320 |
|
| 321 |
$this->add_control( |
| 322 |
'ma_el_creative_button_border_radius', |
| 323 |
[ |
| 324 |
'label' => esc_html__('Border Radius', 'master-addons' ), |
| 325 |
'type' => Controls_Manager::DIMENSIONS, |
| 326 |
'size_units' => ['px', 'em', '%'], |
| 327 |
'default' => [ |
| 328 |
'top' => 8, |
| 329 |
'right' => 8, |
| 330 |
'bottom' => 8, |
| 331 |
'left' => 8, |
| 332 |
'unit' => 'px', |
| 333 |
'isLinked' => true, |
| 334 |
], |
| 335 |
'selectors' => [ |
| 336 |
'{{WRAPPER}} .jltma-creative-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 337 |
'{{WRAPPER}} .jltma-creative-button::before' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 338 |
'{{WRAPPER}} .jltma-creative-button::after' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 339 |
], |
| 340 |
] |
| 341 |
); |
| 342 |
|
| 343 |
$this->add_group_control( |
| 344 |
Group_Control_Box_Shadow::get_type(), |
| 345 |
[ |
| 346 |
'name' => 'button_box_shadow', |
| 347 |
'selector' => '{{WRAPPER}} .jltma-creative-button', |
| 348 |
] |
| 349 |
); |
| 350 |
|
| 351 |
$this->add_control( |
| 352 |
'ma_el_creative_button_icon_size', |
| 353 |
[ |
| 354 |
'label' => __('Icon Size (px)', 'master-addons' ), |
| 355 |
'type' => Controls_Manager::SLIDER, |
| 356 |
'range' => [ |
| 357 |
'px' => [ |
| 358 |
'min' => 10, |
| 359 |
'max' => 100, |
| 360 |
], |
| 361 |
], |
| 362 |
'selectors' => [ |
| 363 |
'{{WRAPPER}} .jltma-creative-button i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 364 |
'{{WRAPPER}} .jltma-creative-button svg' => 'width: {{SIZE}}{{UNIT}};', |
| 365 |
], |
| 366 |
'condition' => [ |
| 367 |
'ma_el_creative_button_icon[value]!' => '', |
| 368 |
], |
| 369 |
] |
| 370 |
); |
| 371 |
|
| 372 |
// Button Normal and Hover Styles |
| 373 |
$this->start_controls_tabs('ma_el_creative_button_tabs'); |
| 374 |
|
| 375 |
$this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'master-addons' )]); |
| 376 |
|
| 377 |
$this->add_control( |
| 378 |
'ma_el_creative_button_text_color', |
| 379 |
[ |
| 380 |
'label' => esc_html__('Text Color', 'master-addons' ), |
| 381 |
'type' => Controls_Manager::COLOR, |
| 382 |
'default' => '#ffffff', |
| 383 |
'selectors' => [ |
| 384 |
'{{WRAPPER}} .jltma-creative-button' => 'color: {{VALUE}};', |
| 385 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--tamaya::before' => 'color: {{VALUE}};', |
| 386 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--tamaya::after' => 'color: {{VALUE}};' |
| 387 |
], |
| 388 |
] |
| 389 |
); |
| 390 |
|
| 391 |
$this->add_control( |
| 392 |
'ma_el_creative_button_background_color', |
| 393 |
[ |
| 394 |
'label' => esc_html__('Background Color', 'master-addons' ), |
| 395 |
'type' => Controls_Manager::COLOR, |
| 396 |
'default' => '#0f172b', |
| 397 |
'selectors' => [ |
| 398 |
'{{WRAPPER}} .jltma-creative-button' => 'background-color: {{VALUE}};', |
| 399 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--ujarak:hover' => 'background-color: {{VALUE}};', |
| 400 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--wayra:hover' => 'background-color: {{VALUE}};', |
| 401 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--tamaya::before' => 'background-color: {{VALUE}};', |
| 402 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--tamaya::after' => 'background-color: {{VALUE}};', |
| 403 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--rayen:hover' => 'background-color: {{VALUE}};' |
| 404 |
], |
| 405 |
] |
| 406 |
); |
| 407 |
|
| 408 |
$this->add_control( |
| 409 |
'ma_el_creative_button_icon_color', |
| 410 |
[ |
| 411 |
'label' => esc_html__('Icon Color', 'master-addons' ), |
| 412 |
'type' => Controls_Manager::COLOR, |
| 413 |
'default' => '#ffffff', |
| 414 |
'selectors' => [ |
| 415 |
'{{WRAPPER}} .jltma-creative-button i' => 'color: {{VALUE}};', |
| 416 |
'{{WRAPPER}} .jltma-creative-button svg' => 'fill: {{VALUE}};', |
| 417 |
], |
| 418 |
'condition' => [ |
| 419 |
'ma_el_creative_button_icon[value]!' => '', |
| 420 |
], |
| 421 |
] |
| 422 |
); |
| 423 |
|
| 424 |
$this->add_control( |
| 425 |
'ma_el_creative_button_before_background_color', |
| 426 |
[ |
| 427 |
'label' => esc_html__('Before BG Color', 'master-addons' ), |
| 428 |
'type' => Controls_Manager::COLOR, |
| 429 |
'default' => '#7986cb', |
| 430 |
'selectors' => [ |
| 431 |
'{{WRAPPER}} .jltma-creative-button--isi:before, |
| 432 |
{{WRAPPER}} .jltma-creative-button--aylen:before, |
| 433 |
{{WRAPPER}} .jltma-creative-button--nuka:before, |
| 434 |
{{WRAPPER}} .jltma-creative-button--naira:before, |
| 435 |
{{WRAPPER}} .jltma-creative-button--quidel:before, |
| 436 |
{{WRAPPER}} .jltma-creative-button--sacnite:before' => 'background-color: {{VALUE}};', |
| 437 |
], |
| 438 |
'condition' => [ |
| 439 |
'creative_button_effect' => [ |
| 440 |
'jltma-creative-button--isi', |
| 441 |
'jltma-creative-button--aylen', |
| 442 |
'jltma-creative-button--nuka', |
| 443 |
'jltma-creative-button--naira', |
| 444 |
'jltma-creative-button--quidel', |
| 445 |
'jltma-creative-button--sacnite', |
| 446 |
] |
| 447 |
], |
| 448 |
] |
| 449 |
); |
| 450 |
|
| 451 |
$this->add_control( |
| 452 |
'ma_el_creative_button_after_background_color', |
| 453 |
[ |
| 454 |
'label' => esc_html__('After BG Color', 'master-addons' ), |
| 455 |
'type' => Controls_Manager::COLOR, |
| 456 |
'default' => '#7986cb', |
| 457 |
'selectors' => [ |
| 458 |
'{{WRAPPER}} .jltma-creative-button--nuka:after, |
| 459 |
{{WRAPPER}} .jltma-creative-button--aylen:after, |
| 460 |
{{WRAPPER}} .jltma-creative-button--pipaluk:after, |
| 461 |
{{WRAPPER}} .jltma-creative-button--saqui:after, |
| 462 |
{{WRAPPER}} .jltma-creative-button--antiman:after' => 'background-color: {{VALUE}};', |
| 463 |
], |
| 464 |
'condition' => [ |
| 465 |
'creative_button_effect' => [ |
| 466 |
'jltma-creative-button--aylen', |
| 467 |
'jltma-creative-button--saqui', |
| 468 |
'jltma-creative-button--nuka', |
| 469 |
'jltma-creative-button--pipaluk', |
| 470 |
'jltma-creative-button--pipaluk', |
| 471 |
'jltma-creative-button--antiman', |
| 472 |
] |
| 473 |
], |
| 474 |
] |
| 475 |
); |
| 476 |
|
| 477 |
$this->add_control( |
| 478 |
'ma_el_creative_button_before_border_color', |
| 479 |
[ |
| 480 |
'label' => esc_html__('Before Border Color', 'master-addons' ), |
| 481 |
'type' => Controls_Manager::COLOR, |
| 482 |
'default' => '#7986cb', |
| 483 |
'selectors' => [ |
| 484 |
'{{WRAPPER}} .jltma-creative-button--wapasha:before, |
| 485 |
{{WRAPPER}} .jltma-creative-button--antiman:before' => 'border-color: {{VALUE}};', |
| 486 |
], |
| 487 |
'condition' => [ |
| 488 |
'creative_button_effect' => [ |
| 489 |
'jltma-creative-button--wapasha', |
| 490 |
'jltma-creative-button--antiman', |
| 491 |
] |
| 492 |
], |
| 493 |
] |
| 494 |
); |
| 495 |
|
| 496 |
$this->end_controls_tab(); |
| 497 |
|
| 498 |
$this->start_controls_tab('ma_el_creative_button_hover', [ |
| 499 |
'label' => esc_html__('Hover', 'master-addons' ) |
| 500 |
]); |
| 501 |
|
| 502 |
$this->add_control( |
| 503 |
'ma_el_creative_button_hover_text_color', |
| 504 |
[ |
| 505 |
'label' => esc_html__('Text Color', 'master-addons' ), |
| 506 |
'type' => Controls_Manager::COLOR, |
| 507 |
'default' => '#ffffff', |
| 508 |
'selectors' => [ |
| 509 |
'{{WRAPPER}} .jltma-creative-button:hover, {{WRAPPER}} .jltma-creative-button.jltma-creative-button--winona::after, {{WRAPPER}} .jltma-creative-button--saqui:hover, {{WRAPPER}} .jltma-creative-button--saqui::after' => 'color: {{VALUE}} !important;', |
| 510 |
], |
| 511 |
] |
| 512 |
); |
| 513 |
|
| 514 |
$this->add_control( |
| 515 |
'ma_el_creative_button_hover_background_color', |
| 516 |
[ |
| 517 |
'label' => esc_html__('Background Color', 'master-addons' ), |
| 518 |
'type' => Controls_Manager::COLOR, |
| 519 |
'default' => '#333', |
| 520 |
'selectors' => [ |
| 521 |
'{{WRAPPER}} .jltma-creative-button:hover' => 'background-color: {{VALUE}};', |
| 522 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--ujarak::before' => 'background-color: {{VALUE}};', |
| 523 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--wayra:hover::before' => 'background-color: {{VALUE}};', |
| 524 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--tamaya:hover' => 'background-color: {{VALUE}};', |
| 525 |
'{{WRAPPER}} .jltma-creative-button.jltma-creative-button--rayen::before' => 'background-color: {{VALUE}};', |
| 526 |
'{{WRAPPER}} .jltma-creative-button--saqui:hover' => 'background-color: {{VALUE}};', |
| 527 |
] |
| 528 |
] |
| 529 |
); |
| 530 |
|
| 531 |
$this->add_control( |
| 532 |
'ma_el_creative_button_hover_icon_color', |
| 533 |
[ |
| 534 |
'label' => esc_html__('Icon Color', 'master-addons' ), |
| 535 |
'type' => Controls_Manager::COLOR, |
| 536 |
'default' => '#ffffff', |
| 537 |
'selectors' => [ |
| 538 |
'{{WRAPPER}} .jltma-creative-button:hover i' => 'color: {{VALUE}};', |
| 539 |
'{{WRAPPER}} .jltma-creative-button:hover svg' => 'fill: {{VALUE}};', |
| 540 |
], |
| 541 |
'condition' => [ |
| 542 |
'ma_el_creative_button_icon[value]!' => '', |
| 543 |
], |
| 544 |
] |
| 545 |
); |
| 546 |
|
| 547 |
$this->add_control( |
| 548 |
'ma_el_creative_button_before_hover_background_color', |
| 549 |
[ |
| 550 |
'label' => esc_html__('Before BG Color', 'master-addons' ), |
| 551 |
'type' => Controls_Manager::COLOR, |
| 552 |
'default' => '#7986cb', |
| 553 |
'selectors' => [ |
| 554 |
'{{WRAPPER}} .jltma-creative-button--nuka:hover:before' => 'background-color: {{VALUE}};', |
| 555 |
], |
| 556 |
'condition' => [ |
| 557 |
'creative_button_effect' => [ |
| 558 |
'jltma-creative-button--nuka', |
| 559 |
] |
| 560 |
], |
| 561 |
] |
| 562 |
); |
| 563 |
|
| 564 |
$this->add_control( |
| 565 |
'ma_el_creative_button_before_hover_after_background_color', |
| 566 |
[ |
| 567 |
'label' => esc_html__('After BG Color', 'master-addons' ), |
| 568 |
'type' => Controls_Manager::COLOR, |
| 569 |
'default' => '#7986cb', |
| 570 |
'selectors' => [ |
| 571 |
'{{WRAPPER}} .jltma-creative-button--nuka:hover:after' => 'background-color: {{VALUE}};', |
| 572 |
], |
| 573 |
'condition' => [ |
| 574 |
'creative_button_effect' => [ |
| 575 |
'jltma-creative-button--nuka', |
| 576 |
] |
| 577 |
], |
| 578 |
] |
| 579 |
); |
| 580 |
|
| 581 |
$this->add_control( |
| 582 |
'ma_el_creative_button_hover_after_background_color', |
| 583 |
[ |
| 584 |
'label' => esc_html__('Background Color', 'master-addons' ), |
| 585 |
'type' => Controls_Manager::COLOR, |
| 586 |
'default' => '#f54', |
| 587 |
'selectors' => [ |
| 588 |
'{{WRAPPER}} .jltma-creative-button--pipaluk:hover:after' => 'background-color: {{VALUE}};', |
| 589 |
], |
| 590 |
'condition' => [ |
| 591 |
'jltma-creative-button--pipaluk' => '', |
| 592 |
], |
| 593 |
] |
| 594 |
); |
| 595 |
|
| 596 |
$this->add_control( |
| 597 |
'ma_el_creative_button_hover_border_color', |
| 598 |
[ |
| 599 |
'label' => esc_html__('Border Color', 'master-addons' ), |
| 600 |
'type' => Controls_Manager::COLOR, |
| 601 |
'default' => '', |
| 602 |
'selectors' => [ |
| 603 |
'{{WRAPPER}} .jltma-creative-button:hover' => 'border-color: {{VALUE}};', |
| 604 |
], |
| 605 |
'condition' => [ |
| 606 |
'ma_el_creative_button_border_border!' => '', |
| 607 |
], |
| 608 |
] |
| 609 |
); |
| 610 |
|
| 611 |
$this->end_controls_tab(); |
| 612 |
|
| 613 |
$this->end_controls_tabs(); |
| 614 |
|
| 615 |
$this->end_controls_section(); |
| 616 |
} |
| 617 |
protected function render() |
| 618 |
{ |
| 619 |
|
| 620 |
$settings = $this->get_settings(); |
| 621 |
$this->add_render_attribute('ma_el_creative_button', [ |
| 622 |
'class' => ['jltma-button jltma-creative-button', esc_attr($settings['creative_button_effect'])], |
| 623 |
'href' => esc_url($settings['creative_button_link_url']['url']), |
| 624 |
]); |
| 625 |
|
| 626 |
if ($settings['creative_button_link_url']['is_external']) { |
| 627 |
$this->add_render_attribute('ma_el_creative_button', 'target', '_blank'); |
| 628 |
} |
| 629 |
|
| 630 |
if ($settings['creative_button_link_url']['nofollow']) { |
| 631 |
$this->add_render_attribute('ma_el_creative_button', 'rel', 'nofollow'); |
| 632 |
} |
| 633 |
|
| 634 |
$this->add_render_attribute('ma_el_creative_button', 'data-text', esc_attr($settings['creative_alternative_button_text'])); |
| 635 |
|
| 636 |
?> |
| 637 |
|
| 638 |
<div class="jltma-creative-button-wrapper"> |
| 639 |
<a <?php echo $this->get_render_attribute_string('ma_el_creative_button'); ?>> |
| 640 |
<?php |
| 641 |
$has_icon = !empty($settings['ma_el_creative_button_icon']['value']); |
| 642 |
$icon_position = $settings['ma_el_creative_button_icon_alignment']; |
| 643 |
$migrated = isset($settings['__fa4_migrated']['ma_el_creative_button_icon']); |
| 644 |
$is_new = empty($settings['icon']) && \Elementor\Icons_Manager::is_migration_allowed(); |
| 645 |
|
| 646 |
// Icon Before Text |
| 647 |
if ($has_icon && $icon_position === 'left') { |
| 648 |
if ($is_new || $migrated) { |
| 649 |
\Elementor\Icons_Manager::render_icon($settings['ma_el_creative_button_icon'], ['aria-hidden' => 'true', 'class' => 'jltma-creative-button-icon-left']); |
| 650 |
} else { ?> |
| 651 |
<i class="jltma-creative-button-icon-left <?php echo esc_attr($settings['icon']); ?>" aria-hidden="true"></i> |
| 652 |
<?php } |
| 653 |
} |
| 654 |
?> |
| 655 |
<span> |
| 656 |
<?php echo esc_html($this->parse_text_editor($settings['creative_button_text'])); ?> |
| 657 |
</span> |
| 658 |
<?php |
| 659 |
// Icon After Text |
| 660 |
if ($has_icon && $icon_position === 'right') { |
| 661 |
if ($is_new || $migrated) { |
| 662 |
\Elementor\Icons_Manager::render_icon($settings['ma_el_creative_button_icon'], ['aria-hidden' => 'true', 'class' => 'jltma-creative-button-icon-right']); |
| 663 |
} else { ?> |
| 664 |
<i class="jltma-creative-button-icon-right <?php echo esc_attr($settings['icon']); ?>" aria-hidden="true"></i> |
| 665 |
<?php } |
| 666 |
} |
| 667 |
?> |
| 668 |
</a> |
| 669 |
</div> |
| 670 |
|
| 671 |
<?php |
| 672 |
} |
| 673 |
|
| 674 |
protected function content_template() |
| 675 |
{ |
| 676 |
} |
| 677 |
} |
| 678 |
|