| 1 |
<?php |
| 2 |
|
| 3 |
namespace MasterAddons\Addons; |
| 4 |
|
| 5 |
use MasterAddons\Inc\Classes\Base\Master_Widget; |
| 6 |
use \Elementor\Controls_Manager as Controls_Manager; |
| 7 |
use \Elementor\Group_Control_Border as Group_Control_Border; |
| 8 |
use \Elementor\Group_Control_Box_Shadow as Group_Control_Box_Shadow; |
| 9 |
use \Elementor\Group_Control_Typography as Group_Control_Typography; |
| 10 |
use \Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 11 |
use MasterAddons\Inc\Classes\Helper; |
| 12 |
use MasterAddons\Inc\Admin\Config; |
| 13 |
|
| 14 |
/** |
| 15 |
* Author Name: Liton Arefin |
| 16 |
* Author URL : https: //jeweltheme.com |
| 17 |
* Date : 6/27/19 |
| 18 |
*/ |
| 19 |
|
| 20 |
if (!defined('ABSPATH')) exit; // If this file is called directly, abort. |
| 21 |
|
| 22 |
class Creative_Links extends Master_Widget |
| 23 |
{ |
| 24 |
use \MasterAddons\Inc\Traits\Widget_Notice; |
| 25 |
use \MasterAddons\Inc\Traits\Widget_Assets_Trait; |
| 26 |
|
| 27 |
public function get_name() |
| 28 |
{ |
| 29 |
return 'ma-creative-links'; |
| 30 |
} |
| 31 |
|
| 32 |
public function get_title() |
| 33 |
{ |
| 34 |
return esc_html__('Creative Links', 'master-addons'); |
| 35 |
} |
| 36 |
|
| 37 |
public function get_icon() |
| 38 |
{ |
| 39 |
return 'jltma-icon ' . Config::get_addon_icon($this->get_name()); |
| 40 |
} |
| 41 |
|
| 42 |
protected function register_controls() |
| 43 |
{ |
| 44 |
|
| 45 |
// Style Presets |
| 46 |
$this->start_controls_section( |
| 47 |
'ma_el_creative_link_content_section', |
| 48 |
[ |
| 49 |
'label' => esc_html__('Contents', 'master-addons') |
| 50 |
] |
| 51 |
); |
| 52 |
|
| 53 |
// Define default free options - Pro version overrides via filter |
| 54 |
$link_effect_options = apply_filters('master_addons/addons/creative_links/link_effect', [ |
| 55 |
'jltma-cl-effect-1' => esc_html__('Brackets', 'master-addons'), |
| 56 |
'jltma-cl-effect-3' => esc_html__('Bottom Line Slide', 'master-addons'), |
| 57 |
'jltma-cl-effect-4' => esc_html__('Bottom Border Enlarge', 'master-addons'), |
| 58 |
'jltma-cl-effect-7' => esc_html__('2nd Border Slide Up', 'master-addons'), |
| 59 |
'jltma-cl-effect-11' => esc_html__('Text Fill', 'master-addons'), |
| 60 |
'jltma-cl-effect-13' => esc_html__('Three Dots', 'master-addons'), |
| 61 |
'jltma-cl-effect-15' => esc_html__('Scale Down', 'master-addons'), |
| 62 |
'jltma-cl-effect-17' => esc_html__('Move Up', 'master-addons'), |
| 63 |
'jltma-cl-effect-21' => esc_html__('Basic Effect', 'master-addons'), |
| 64 |
'jltma-cl-effect-22' => esc_html__('Effect 22', 'master-addons'), |
| 65 |
'cl-pro-link-1' => esc_html__('3D Effect (Pro)', 'master-addons'), |
| 66 |
'cl-pro-link-2' => esc_html__('Slide In (Pro)', 'master-addons'), |
| 67 |
'cl-pro-link-3' => esc_html__('Border Slide Down (Pro)', 'master-addons'), |
| 68 |
'cl-pro-link-4' => esc_html__('Border Translate (Pro)', 'master-addons'), |
| 69 |
'cl-pro-link-5' => esc_html__('2nd Text and Border (Pro)', 'master-addons'), |
| 70 |
'cl-pro-link-6' => esc_html__('Reveal Push Out (Pro)', 'master-addons'), |
| 71 |
'cl-pro-link-7' => esc_html__('Circle (Pro)', 'master-addons'), |
| 72 |
'cl-pro-link' => esc_html__('Border Switch (Pro)', 'master-addons'), |
| 73 |
'cl-pro-link-8' => esc_html__('Fall Down (Pro)', 'master-addons'), |
| 74 |
'cl-pro-link-9' => esc_html__('Cross (Pro)', 'master-addons'), |
| 75 |
'cl-pro-link-10' => esc_html__('3D Slide (Pro)', 'master-addons'), |
| 76 |
'cl-pro-link-11' => esc_html__('3D Slide Down (Pro)', 'master-addons'), |
| 77 |
]); |
| 78 |
|
| 79 |
$this->add_control( |
| 80 |
'creative_link_effect', |
| 81 |
[ |
| 82 |
'label' => esc_html__('Effects', 'master-addons'), |
| 83 |
'type' => Controls_Manager::SELECT, |
| 84 |
'default' => 'jltma-cl-effect-1', |
| 85 |
'options' => $link_effect_options, |
| 86 |
'description' => Helper::upgrade_to_pro('14+ more effects on'), |
| 87 |
] |
| 88 |
); |
| 89 |
|
| 90 |
$this->add_responsive_control( |
| 91 |
'ma_el_creative_link_item_alignment', |
| 92 |
[ |
| 93 |
'label' => esc_html__('Item Alignment', 'master-addons'), |
| 94 |
'type' => Controls_Manager::CHOOSE, |
| 95 |
'label_block' => false, |
| 96 |
'options' => [ |
| 97 |
'flex-start' => [ |
| 98 |
'title' => esc_html__('Left', 'master-addons'), |
| 99 |
'icon' => 'eicon-text-align-left', |
| 100 |
], |
| 101 |
'center' => [ |
| 102 |
'title' => esc_html__('Center', 'master-addons'), |
| 103 |
'icon' => 'eicon-text-align-center', |
| 104 |
], |
| 105 |
'flex-end' => [ |
| 106 |
'title' => esc_html__('Right', 'master-addons'), |
| 107 |
'icon' => 'eicon-text-align-right', |
| 108 |
], |
| 109 |
], |
| 110 |
'default' => 'center', |
| 111 |
'selectors' => [ |
| 112 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link' => 'justify-content: {{VALUE}};', |
| 113 |
], |
| 114 |
] |
| 115 |
); |
| 116 |
|
| 117 |
$this->add_control( |
| 118 |
'creative_link_text', |
| 119 |
[ |
| 120 |
'label' => esc_html__('Link Text', 'master-addons'), |
| 121 |
'type' => Controls_Manager::TEXT, |
| 122 |
'label_block' => true, |
| 123 |
'default' => 'Click Here', |
| 124 |
'placeholder' => esc_html__('Enter Link text', 'master-addons'), |
| 125 |
'title' => esc_html__('Enter Link text here', 'master-addons'), |
| 126 |
] |
| 127 |
); |
| 128 |
|
| 129 |
$this->add_control( |
| 130 |
'ma_el_creative_link_icon', |
| 131 |
[ |
| 132 |
'label' => esc_html__('Icon', 'master-addons'), |
| 133 |
'description' => esc_html__('Please choose an icon from the list.', 'master-addons'), |
| 134 |
'type' => Controls_Manager::ICONS, |
| 135 |
'render_type' => 'template', |
| 136 |
'condition' => [ |
| 137 |
'creative_link_effect!' => 'jltma-cl-effect-11', |
| 138 |
], |
| 139 |
] |
| 140 |
); |
| 141 |
|
| 142 |
$this->add_control( |
| 143 |
'ma_el_creative_link_icon_alignment', |
| 144 |
[ |
| 145 |
'label' => esc_html__('Icon Position', 'master-addons'), |
| 146 |
'type' => Controls_Manager::CHOOSE, |
| 147 |
'default' => 'right', |
| 148 |
'options' => [ |
| 149 |
'left' => [ |
| 150 |
'title' => esc_html__('Left', 'master-addons'), |
| 151 |
'icon' => 'eicon-h-align-left', |
| 152 |
], |
| 153 |
'right' => [ |
| 154 |
'title' => esc_html__('Right', 'master-addons'), |
| 155 |
'icon' => 'eicon-h-align-right', |
| 156 |
], |
| 157 |
], |
| 158 |
'condition' => [ |
| 159 |
'ma_el_creative_link_icon[value]!' => '', |
| 160 |
], |
| 161 |
] |
| 162 |
); |
| 163 |
|
| 164 |
$this->add_control( |
| 165 |
'creative_alternative_link_text', |
| 166 |
[ |
| 167 |
'label' => esc_html__('Alternative Link Text', 'master-addons'), |
| 168 |
'type' => Controls_Manager::TEXT, |
| 169 |
'label_block' => true, |
| 170 |
'default' => 'Go!', |
| 171 |
'placeholder' => esc_html__('Enter Alternative Link text', 'master-addons'), |
| 172 |
'title' => esc_html__('Enter Alternative Link text here', 'master-addons'), |
| 173 |
'condition' => [ |
| 174 |
'ma_el_creative_link_icon!' => '', |
| 175 |
'creative_link_effect!' => 'jltma-cl-effect-11', |
| 176 |
'creative_link_effect!' => 'jltma-cl-effect-15', |
| 177 |
'creative_link_effect!' => 'jltma-cl-effect-16', |
| 178 |
], |
| 179 |
] |
| 180 |
); |
| 181 |
|
| 182 |
$this->add_control( |
| 183 |
'creative_link_url', |
| 184 |
[ |
| 185 |
'label' => esc_html__('Link URL', 'master-addons'), |
| 186 |
'type' => Controls_Manager::URL, |
| 187 |
'label_block' => true, |
| 188 |
'default' => [ |
| 189 |
'url' => '#', |
| 190 |
'is_external' => '', |
| 191 |
], |
| 192 |
'show_external' => true, |
| 193 |
] |
| 194 |
); |
| 195 |
|
| 196 |
$this->add_responsive_control( |
| 197 |
'ma_el_creative_link_alignment', |
| 198 |
[ |
| 199 |
'label' => esc_html__('Link Alignment', 'master-addons'), |
| 200 |
'type' => Controls_Manager::CHOOSE, |
| 201 |
'label_block' => false, |
| 202 |
'options' => Helper::jltma_content_alignment(), |
| 203 |
'default' => 'center', |
| 204 |
'selectors' => [ |
| 205 |
'{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-1 .jltma-creative-link .jltma-creative-link-item, |
| 206 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-2 .jltma-creative-link .jltma-creative-link-item, |
| 207 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-2 .jltma-creative-link .jltma-creative-link-item span, |
| 208 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-3 .jltma-creative-link .jltma-creative-link-item, |
| 209 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-4 .jltma-creative-link .jltma-creative-link-item, |
| 210 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-5 .jltma-creative-link .jltma-creative-link-item, |
| 211 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-6 .jltma-creative-link .jltma-creative-link-item, |
| 212 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-7 .jltma-creative-link .jltma-creative-link-item, |
| 213 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-8 .jltma-creative-link .jltma-creative-link-item, |
| 214 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-9 .jltma-creative-link .jltma-creative-link-item, |
| 215 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-10 .jltma-creative-link .jltma-creative-link-item, |
| 216 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-11 .jltma-creative-link .jltma-creative-link-item, |
| 217 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-12 .jltma-creative-link .jltma-creative-link-item, |
| 218 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-13 .jltma-creative-link .jltma-creative-link-item, |
| 219 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-14 .jltma-creative-link .jltma-creative-link-item, |
| 220 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-17 .jltma-creative-link .jltma-creative-link-item, |
| 221 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-18 .jltma-creative-link .jltma-creative-link-item, |
| 222 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-19 .jltma-creative-link .jltma-creative-link-item, |
| 223 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-20 .jltma-creative-link .jltma-creative-link-item, |
| 224 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-20 .jltma-creative-link span, |
| 225 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-21 .jltma-creative-link .jltma-creative-link-item' => 'text-align: {{VALUE}};', |
| 226 |
], |
| 227 |
] |
| 228 |
); |
| 229 |
|
| 230 |
$this->add_responsive_control( |
| 231 |
'ma_el_creative_link_after_text_alignment', |
| 232 |
[ |
| 233 |
'label' => esc_html__('Back Text Alignment', 'master-addons'), |
| 234 |
'type' => Controls_Manager::CHOOSE, |
| 235 |
'default' => 'center', |
| 236 |
'options' => [ |
| 237 |
'flex-start' => [ |
| 238 |
'title' => __('Left', 'master-addons'), |
| 239 |
'icon' => 'fa fa-align-left', |
| 240 |
], |
| 241 |
'center' => [ |
| 242 |
'title' => __('Center', 'master-addons'), |
| 243 |
'icon' => 'fa fa-align-center', |
| 244 |
], |
| 245 |
'flex-end' => [ |
| 246 |
'title' => __('Right', 'master-addons'), |
| 247 |
'icon' => 'fa fa-align-right', |
| 248 |
], |
| 249 |
], |
| 250 |
'selectors' => [ |
| 251 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item:before' => 'justify-content: {{VALUE}};', |
| 252 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item:after' => 'justify-content: {{VALUE}};', |
| 253 |
], |
| 254 |
] |
| 255 |
); |
| 256 |
|
| 257 |
$this->add_control( |
| 258 |
'ma_el_creative_link_icon_indent', |
| 259 |
[ |
| 260 |
'label' => esc_html__('Icon Spacing', 'master-addons'), |
| 261 |
'type' => Controls_Manager::SLIDER, |
| 262 |
'range' => [ |
| 263 |
'px' => [ |
| 264 |
'max' => 60, |
| 265 |
], |
| 266 |
], |
| 267 |
'condition' => [ |
| 268 |
'ma_el_creative_link_icon!' => '', |
| 269 |
], |
| 270 |
'selectors' => [ |
| 271 |
'{{WRAPPER}} .jltma-creative-link-icon-right' => 'margin-left: {{SIZE}}px;', |
| 272 |
'{{WRAPPER}} .jltma-creative-link-icon-left' => 'margin-right: {{SIZE}}px;', |
| 273 |
'{{WRAPPER}} .jltma-creative-link i' => 'left: -{{SIZE}}px;', |
| 274 |
], |
| 275 |
] |
| 276 |
); |
| 277 |
|
| 278 |
$this->end_controls_section(); |
| 279 |
|
| 280 |
// Help Docs section (links from config.php) |
| 281 |
$this->jltma_help_docs(); |
| 282 |
|
| 283 |
$this->upgrade_to_pro_message(); |
| 284 |
|
| 285 |
/* |
| 286 |
* Master Addons: Style Controls |
| 287 |
*/ |
| 288 |
$this->start_controls_section( |
| 289 |
'ma_el_creative_link_settings', |
| 290 |
[ |
| 291 |
'label' => esc_html__('Link Styles', 'master-addons'), |
| 292 |
'tab' => Controls_Manager::TAB_STYLE |
| 293 |
] |
| 294 |
); |
| 295 |
|
| 296 |
$this->add_responsive_control( |
| 297 |
'ma_el_creative_link_width', |
| 298 |
[ |
| 299 |
'label' => esc_html__('Width', 'master-addons'), |
| 300 |
'type' => Controls_Manager::SLIDER, |
| 301 |
'size_units' => ['px', '%'], |
| 302 |
'range' => [ |
| 303 |
'px' => [ |
| 304 |
'min' => 0, |
| 305 |
'max' => 500, |
| 306 |
'step' => 1, |
| 307 |
], |
| 308 |
'%' => [ |
| 309 |
'min' => 0, |
| 310 |
'max' => 100, |
| 311 |
], |
| 312 |
], |
| 313 |
'selectors' => [ |
| 314 |
'{{WRAPPER}} .jltma-creative-link' => 'width: {{SIZE}}{{UNIT}};', |
| 315 |
], |
| 316 |
] |
| 317 |
); |
| 318 |
|
| 319 |
$this->add_control( |
| 320 |
'ma_el_creative_link_icon_size', |
| 321 |
[ |
| 322 |
'label' => __('Icon Size (px)', 'master-addons'), |
| 323 |
'type' => Controls_Manager::SLIDER, |
| 324 |
'default' => [ |
| 325 |
'size' => 15, |
| 326 |
], |
| 327 |
'range' => [ |
| 328 |
'px' => [ |
| 329 |
'min' => 10, |
| 330 |
'max' => 100, |
| 331 |
], |
| 332 |
], |
| 333 |
'selectors' => [ |
| 334 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 335 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link a svg' => 'width: {{SIZE}}{{UNIT}};', |
| 336 |
], |
| 337 |
] |
| 338 |
); |
| 339 |
|
| 340 |
$this->add_group_control( |
| 341 |
Group_Control_Typography::get_type(), |
| 342 |
[ |
| 343 |
'name' => 'ma_el_creative_link_typography', |
| 344 |
'global' => [ |
| 345 |
'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 346 |
], |
| 347 |
'selector' => '{{WRAPPER}} .jltma-creative-links .jltma-creative-link .jltma-creative-link-item', |
| 348 |
] |
| 349 |
); |
| 350 |
|
| 351 |
$this->add_responsive_control( |
| 352 |
'ma_el_creative_link_padding', |
| 353 |
[ |
| 354 |
'label' => esc_html__('Link Padding', 'master-addons'), |
| 355 |
'type' => Controls_Manager::DIMENSIONS, |
| 356 |
'size_units' => ['px', 'em', '%'], |
| 357 |
'selectors' => [ |
| 358 |
'{{WRAPPER}} .jltma-creative-link-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 359 |
'{{WRAPPER}} .jltma-cl-effect-11 .jltma-creative-link-item::before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 360 |
'{{WRAPPER}} .jltma-cl-effect-5 .jltma-creative-link-item span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 361 |
'{{WRAPPER}} .jltma-cl-effect-10 .jltma-creative-link-item::before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 362 |
'{{WRAPPER}} .jltma-cl-effect-15 .jltma-creative-link-item::before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 363 |
'{{WRAPPER}} .jltma-cl-effect-16 .jltma-creative-link-item::before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 364 |
'{{WRAPPER}} .jltma-cl-effect-17 .jltma-creative-link-item::before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 365 |
'{{WRAPPER}} .jltma-cl-effect-19 .jltma-creative-link-item span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 366 |
'{{WRAPPER}} .jltma-cl-effect-19 .jltma-creative-link-item span::before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 367 |
], |
| 368 |
] |
| 369 |
); |
| 370 |
|
| 371 |
$this->add_group_control( |
| 372 |
Group_Control_Border::get_type(), |
| 373 |
[ |
| 374 |
'name' => 'ma_el_creative_link_border', |
| 375 |
'selector' => '{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item', |
| 376 |
'fields_options' => [ |
| 377 |
'border' => [ |
| 378 |
'default' => 'solid', |
| 379 |
], |
| 380 |
'width' => [ |
| 381 |
'default' => [ |
| 382 |
'top' => '1', |
| 383 |
'right' => '1', |
| 384 |
'bottom' => '1', |
| 385 |
'left' => '1', |
| 386 |
'isLinked' => true, |
| 387 |
], |
| 388 |
], |
| 389 |
'color' => [ |
| 390 |
'default' => '#E2E8F0', |
| 391 |
], |
| 392 |
], |
| 393 |
] |
| 394 |
); |
| 395 |
|
| 396 |
$this->add_responsive_control( |
| 397 |
'ma_el_creative_link_border_radius', |
| 398 |
[ |
| 399 |
'label' => esc_html__('Border Radius', 'master-addons'), |
| 400 |
'type' => Controls_Manager::DIMENSIONS, |
| 401 |
'size_units' => ['px', 'em', '%'], |
| 402 |
'default' => [ |
| 403 |
'top' => '8', |
| 404 |
'right' => '8', |
| 405 |
'bottom' => '8', |
| 406 |
'left' => '8', |
| 407 |
'unit' => 'px', |
| 408 |
'isLinked' => true, |
| 409 |
], |
| 410 |
'selectors' => [ |
| 411 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 412 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item::before' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 413 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item::after' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 414 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item span' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 415 |
], |
| 416 |
] |
| 417 |
); |
| 418 |
|
| 419 |
$this->add_group_control( |
| 420 |
Group_Control_Box_Shadow::get_type(), |
| 421 |
[ |
| 422 |
'name' => 'link_box_shadow', |
| 423 |
'selector' => '{{WRAPPER}} .jltma-creative-link', |
| 424 |
] |
| 425 |
); |
| 426 |
|
| 427 |
// Link Style Tabs |
| 428 |
$this->start_controls_tabs('ma_el_creative_link_tabs'); |
| 429 |
|
| 430 |
$this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'master-addons')]); |
| 431 |
|
| 432 |
$this->add_control( |
| 433 |
'ma_el_creative_link_text_color', |
| 434 |
[ |
| 435 |
'label' => esc_html__('Text Color', 'master-addons'), |
| 436 |
'type' => Controls_Manager::COLOR, |
| 437 |
'default' => '#fff', |
| 438 |
'selectors' => [ |
| 439 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link a' => 'color: {{VALUE}};', |
| 440 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link a svg' => 'fill: {{VALUE}};', |
| 441 |
'{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-20 a span' => 'box-shadow: inset 0 3px {{VALUE}};', |
| 442 |
'{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-8 a::before, |
| 443 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-8 a::after' => 'border: 3px solid {{VALUE}};', |
| 444 |
], |
| 445 |
] |
| 446 |
); |
| 447 |
|
| 448 |
$this->add_control( |
| 449 |
'ma_el_creative_link_background_color', |
| 450 |
[ |
| 451 |
'label' => esc_html__('Background Color', 'master-addons'), |
| 452 |
'type' => Controls_Manager::COLOR, |
| 453 |
'default' => '#020817', |
| 454 |
'selectors' => [ |
| 455 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item' => 'background-color: {{VALUE}};' |
| 456 |
], |
| 457 |
] |
| 458 |
); |
| 459 |
|
| 460 |
$this->add_control( |
| 461 |
'ma_el_creative_link_background_span_color', |
| 462 |
[ |
| 463 |
'label' => esc_html__('Front BG Color', 'master-addons'), |
| 464 |
'type' => Controls_Manager::COLOR, |
| 465 |
'default' => '', |
| 466 |
'selectors' => [ |
| 467 |
|
| 468 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item span' => 'background-color: {{VALUE}};', |
| 469 |
], |
| 470 |
] |
| 471 |
); |
| 472 |
|
| 473 |
$this->add_control( |
| 474 |
'ma_el_creative_link_before_background_color', |
| 475 |
[ |
| 476 |
'label' => esc_html__('Before BG Color', 'master-addons'), |
| 477 |
'type' => Controls_Manager::COLOR, |
| 478 |
'default' => '', |
| 479 |
'selectors' => [ |
| 480 |
|
| 481 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item:before' => 'background-color: {{VALUE}};', |
| 482 |
], |
| 483 |
] |
| 484 |
); |
| 485 |
|
| 486 |
$this->add_control( |
| 487 |
'ma_el_creative_link_after_background_color', |
| 488 |
[ |
| 489 |
'label' => esc_html__('After BG Color', 'master-addons'), |
| 490 |
'type' => Controls_Manager::COLOR, |
| 491 |
'default' => '', |
| 492 |
'selectors' => [ |
| 493 |
|
| 494 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item:after' => 'background-color: {{VALUE}};', |
| 495 |
], |
| 496 |
] |
| 497 |
); |
| 498 |
$this->add_control( |
| 499 |
'ma_el_creative_link_hover_fill_text_color', |
| 500 |
[ |
| 501 |
'label' => esc_html__('Text Fill Color', 'master-addons'), |
| 502 |
'type' => Controls_Manager::COLOR, |
| 503 |
'default' => '', |
| 504 |
'selectors' => [ |
| 505 |
|
| 506 |
'{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-11 a::before' => 'color: {{VALUE}};border-color: {{VALUE}};', |
| 507 |
], |
| 508 |
'condition' => [ |
| 509 |
'creative_link_effect' => 'jltma-cl-effect-11' |
| 510 |
] |
| 511 |
] |
| 512 |
); |
| 513 |
|
| 514 |
$this->end_controls_tab(); |
| 515 |
|
| 516 |
$this->start_controls_tab('ma_el_creative_link_hover', [ |
| 517 |
'label' => esc_html__('Hover', 'master-addons') |
| 518 |
]); |
| 519 |
|
| 520 |
$this->add_control( |
| 521 |
'ma_el_creative_link_hover_text_color', |
| 522 |
[ |
| 523 |
'label' => esc_html__('Text Color', 'master-addons'), |
| 524 |
'type' => Controls_Manager::COLOR, |
| 525 |
'default' => '#E2E8F0', |
| 526 |
'selectors' => [ |
| 527 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link a:hover, |
| 528 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-9 a span:last-child, |
| 529 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-20 a span::before' => 'color: {{VALUE}};', |
| 530 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link a:hover svg' => 'fill: {{VALUE}};', |
| 531 |
'{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-8 a::after' => 'border-color: {{VALUE}};', |
| 532 |
'{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-13 a:hover::before, |
| 533 |
{{WRAPPER}} .jltma-creative-links.jltma-cl-effect-13 a:focus::before' => 'color: {{VALUE}}; text-shadow: 10px 0 {{VALUE}}, -10px 0 {{VALUE}};', |
| 534 |
], |
| 535 |
] |
| 536 |
); |
| 537 |
|
| 538 |
$this->add_control( |
| 539 |
'ma_el_creative_link_hover_background_color', |
| 540 |
[ |
| 541 |
'label' => esc_html__('Background Color', 'master-addons'), |
| 542 |
'type' => Controls_Manager::COLOR, |
| 543 |
'default' => '', |
| 544 |
'selectors' => [ |
| 545 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item:hover' => 'background-color: {{VALUE}};' |
| 546 |
] |
| 547 |
] |
| 548 |
); |
| 549 |
|
| 550 |
$this->add_control( |
| 551 |
'ma_el_creative_link_hover_background_span_color', |
| 552 |
[ |
| 553 |
'label' => esc_html__('Back BG Color', 'master-addons'), |
| 554 |
'type' => Controls_Manager::COLOR, |
| 555 |
'default' => '', |
| 556 |
'selectors' => [ |
| 557 |
|
| 558 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item:hover span' => 'background-color: {{VALUE}};', |
| 559 |
], |
| 560 |
] |
| 561 |
); |
| 562 |
|
| 563 |
$this->add_control( |
| 564 |
'ma_el_creative_link_hover_before_background_color', |
| 565 |
[ |
| 566 |
'label' => esc_html__('Before BG Color', 'master-addons'), |
| 567 |
'type' => Controls_Manager::COLOR, |
| 568 |
'default' => '', |
| 569 |
'selectors' => [ |
| 570 |
|
| 571 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item:hover:before' => 'background-color: {{VALUE}};', |
| 572 |
], |
| 573 |
] |
| 574 |
); |
| 575 |
|
| 576 |
$this->add_control( |
| 577 |
'ma_el_creative_link_hover_after_background_color', |
| 578 |
[ |
| 579 |
'label' => esc_html__('After BG Color', 'master-addons'), |
| 580 |
'type' => Controls_Manager::COLOR, |
| 581 |
'default' => '', |
| 582 |
'selectors' => [ |
| 583 |
|
| 584 |
'{{WRAPPER}} .jltma-creative-links .jltma-creative-link-item:hover:after' => 'background-color: {{VALUE}};', |
| 585 |
], |
| 586 |
] |
| 587 |
); |
| 588 |
|
| 589 |
$this->end_controls_tab(); |
| 590 |
|
| 591 |
$this->end_controls_tabs(); |
| 592 |
|
| 593 |
$this->end_controls_section(); |
| 594 |
} |
| 595 |
|
| 596 |
protected function render() |
| 597 |
{ |
| 598 |
$settings = $this->get_settings(); |
| 599 |
$link_id = $this->get_id(); |
| 600 |
$effect = $settings['creative_link_effect']; |
| 601 |
|
| 602 |
// Effects that need data-hover attribute |
| 603 |
$data_hover_effects = [ |
| 604 |
'jltma-cl-effect-10', 'jltma-cl-effect-11', 'jltma-cl-effect-15', |
| 605 |
'jltma-cl-effect-16', 'jltma-cl-effect-17', 'jltma-cl-effect-18', |
| 606 |
'jltma-cl-effect-19', 'jltma-cl-effect-20' |
| 607 |
]; |
| 608 |
|
| 609 |
// Effects that need 3D wrapper |
| 610 |
$transform_3d_effects = ['jltma-cl-effect-2', 'jltma-cl-effect-19', 'jltma-cl-effect-20']; |
| 611 |
|
| 612 |
// Effects that need span wrapper for content |
| 613 |
$span_wrapper_effects = ['jltma-cl-effect-2', 'jltma-cl-effect-5', 'jltma-cl-effect-19', 'jltma-cl-effect-20']; |
| 614 |
|
| 615 |
// Effects where icon should not show (text fill effects) |
| 616 |
$no_icon_effects = ['jltma-cl-effect-10', 'jltma-cl-effect-11', 'jltma-cl-effect-15', 'jltma-cl-effect-16', 'jltma-cl-effect-17']; |
| 617 |
|
| 618 |
$this->add_render_attribute('ma_el_creative_links_wrapper', [ |
| 619 |
'class' => ['jltma-creative-links', esc_attr($effect)], |
| 620 |
'id' => 'ma-creative-link-' . esc_attr($link_id) |
| 621 |
]); |
| 622 |
|
| 623 |
$this->add_render_attribute('ma_el_creative_link', [ |
| 624 |
'class' => 'jltma-creative-link-item', |
| 625 |
'href' => esc_url_raw($settings['creative_link_url']['url']), |
| 626 |
]); |
| 627 |
|
| 628 |
if ($settings['creative_link_url']['is_external']) { |
| 629 |
$this->add_render_attribute('ma_el_creative_link', 'target', '_blank'); |
| 630 |
} |
| 631 |
|
| 632 |
if ($settings['creative_link_url']['nofollow']) { |
| 633 |
$this->add_render_attribute('ma_el_creative_link', 'rel', 'nofollow'); |
| 634 |
} |
| 635 |
|
| 636 |
// Add data-hover for effects that need it |
| 637 |
if (in_array($effect, $data_hover_effects)) { |
| 638 |
$data_hover_text = in_array($effect, ['jltma-cl-effect-11', 'jltma-cl-effect-15', 'jltma-cl-effect-16']) |
| 639 |
? $settings['creative_link_text'] |
| 640 |
: (!empty($settings['creative_alternative_link_text']) ? $settings['creative_alternative_link_text'] : $settings['creative_link_text']); |
| 641 |
$this->add_render_attribute('ma_el_creative_link', 'data-hover', esc_attr($data_hover_text)); |
| 642 |
} |
| 643 |
|
| 644 |
// Icon settings |
| 645 |
$has_icon = !empty($settings['ma_el_creative_link_icon']['value']); |
| 646 |
$icon_position = $settings['ma_el_creative_link_icon_alignment']; |
| 647 |
$show_icon = $has_icon && !in_array($effect, $no_icon_effects); |
| 648 |
$migrated = isset($settings['__fa4_migrated']['ma_el_creative_link_icon']); |
| 649 |
$is_new = empty($settings['icon']) && \Elementor\Icons_Manager::is_migration_allowed(); |
| 650 |
|
| 651 |
// 3D wrapper start |
| 652 |
if (in_array($effect, $transform_3d_effects)) { |
| 653 |
echo '<div class="csstransforms3d">'; |
| 654 |
} |
| 655 |
?> |
| 656 |
|
| 657 |
<div <?php echo $this->get_render_attribute_string('ma_el_creative_links_wrapper'); ?>> |
| 658 |
<div class="jltma-creative-link"> |
| 659 |
<a <?php echo $this->get_render_attribute_string('ma_el_creative_link'); ?>> |
| 660 |
<?php |
| 661 |
// Span wrapper start for specific effects |
| 662 |
if (in_array($effect, $span_wrapper_effects)) { |
| 663 |
$span_data_hover = !empty($settings['creative_alternative_link_text']) ? $settings['creative_alternative_link_text'] : $settings['creative_link_text']; |
| 664 |
echo '<span data-hover="' . esc_attr($span_data_hover) . '">'; |
| 665 |
} |
| 666 |
|
| 667 |
// Icon Before Text |
| 668 |
if ($show_icon && $icon_position === 'left') { |
| 669 |
if ($is_new || $migrated) { |
| 670 |
\Elementor\Icons_Manager::render_icon($settings['ma_el_creative_link_icon'], ['aria-hidden' => 'true', 'class' => 'jltma-creative-link-icon-left']); |
| 671 |
} else { |
| 672 |
echo '<i class="jltma-creative-link-icon-left ' . esc_attr($settings['icon']) . '" aria-hidden="true"></i>'; |
| 673 |
} |
| 674 |
} |
| 675 |
|
| 676 |
// Text content |
| 677 |
if ($effect === 'jltma-cl-effect-10') { |
| 678 |
echo '<span>' . esc_html($this->parse_text_editor($settings['creative_link_text'])) . '</span>'; |
| 679 |
} else { |
| 680 |
echo '<span class="jltma-creative-link-text">' . esc_html($this->parse_text_editor($settings['creative_link_text'])) . '</span>'; |
| 681 |
} |
| 682 |
|
| 683 |
// Alternative text for effect 9 |
| 684 |
if ($effect === 'jltma-cl-effect-9') { |
| 685 |
$alt_text = !empty($settings['creative_alternative_link_text']) ? $settings['creative_alternative_link_text'] : $settings['creative_link_text']; |
| 686 |
echo '<span>' . esc_html($this->parse_text_editor($alt_text)) . '</span>'; |
| 687 |
} |
| 688 |
|
| 689 |
// Icon After Text |
| 690 |
if ($show_icon && $icon_position === 'right') { |
| 691 |
if ($is_new || $migrated) { |
| 692 |
\Elementor\Icons_Manager::render_icon($settings['ma_el_creative_link_icon'], ['aria-hidden' => 'true', 'class' => 'jltma-creative-link-icon-right']); |
| 693 |
} else { |
| 694 |
echo '<i class="jltma-creative-link-icon-right ' . esc_attr($settings['icon']) . '" aria-hidden="true"></i>'; |
| 695 |
} |
| 696 |
} |
| 697 |
|
| 698 |
// Span wrapper end for specific effects |
| 699 |
if (in_array($effect, $span_wrapper_effects)) { |
| 700 |
echo '</span>'; |
| 701 |
} |
| 702 |
?> |
| 703 |
</a> |
| 704 |
</div> |
| 705 |
</div> |
| 706 |
|
| 707 |
<?php |
| 708 |
// 3D wrapper end |
| 709 |
if (in_array($effect, $transform_3d_effects)) { |
| 710 |
echo '</div>'; |
| 711 |
} |
| 712 |
} |
| 713 |
} |
| 714 |
|