| 1 |
<?php |
| 2 |
|
| 3 |
namespace MasterAddons\Addons; |
| 4 |
|
| 5 |
use MasterAddons\Inc\Classes\Base\Master_Widget; |
| 6 |
use \Elementor\Controls_Manager; |
| 7 |
use \Elementor\Utils; |
| 8 |
use \Elementor\Repeater; |
| 9 |
use \Elementor\Group_Control_Image_Size; |
| 10 |
use \Elementor\Group_Control_Background; |
| 11 |
use \Elementor\Group_Control_Box_Shadow; |
| 12 |
use \Elementor\Group_Control_Border; |
| 13 |
use \Elementor\Group_Control_Typography; |
| 14 |
use \Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 15 |
use \Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 16 |
|
| 17 |
use MasterAddons\Inc\Admin\Config; |
| 18 |
|
| 19 |
/** |
| 20 |
* Author Name: Liton Arefin |
| 21 |
* Author URL : https: //jeweltheme.com |
| 22 |
* Date : 6/27/19 |
| 23 |
*/ |
| 24 |
|
| 25 |
if (!defined('ABSPATH')) exit; // If this file is called directly, abort. |
| 26 |
class Counter_Up extends Master_Widget |
| 27 |
{ |
| 28 |
use \MasterAddons\Inc\Traits\Widget_Notice; |
| 29 |
use \MasterAddons\Inc\Traits\Widget_Assets_Trait; |
| 30 |
|
| 31 |
public function get_name() |
| 32 |
{ |
| 33 |
return 'jltma-counter-up'; |
| 34 |
} |
| 35 |
public function get_title() |
| 36 |
{ |
| 37 |
return esc_html__('Counter Up', 'master-addons' ); |
| 38 |
} |
| 39 |
public function get_icon() |
| 40 |
{ |
| 41 |
return 'jltma-icon ' . Config::get_addon_icon('ma-counter-up'); |
| 42 |
} |
| 43 |
|
| 44 |
protected function register_controls() |
| 45 |
{ |
| 46 |
|
| 47 |
$this->start_controls_section( |
| 48 |
'ma_el_counterup_section_start', |
| 49 |
[ |
| 50 |
'label' => __('Counter Up Content', 'master-addons' ) |
| 51 |
] |
| 52 |
); |
| 53 |
|
| 54 |
$repeater = new Repeater(); |
| 55 |
|
| 56 |
$repeater->add_control( |
| 57 |
'icon_type', |
| 58 |
[ |
| 59 |
'type' => Controls_Manager::CHOOSE, |
| 60 |
'label_block' => true, |
| 61 |
'label' => esc_html__('Type', 'master-addons' ), |
| 62 |
'default' => 'icon', |
| 63 |
'options' => [ |
| 64 |
'none' => [ |
| 65 |
'title' => esc_html__('None', 'master-addons' ), |
| 66 |
'icon' => 'eicon-ban', |
| 67 |
], |
| 68 |
'icon' => [ |
| 69 |
'title' => esc_html__('Icon', 'master-addons' ), |
| 70 |
'icon' => 'eicon-icon-box', |
| 71 |
], |
| 72 |
'custom' => [ |
| 73 |
'title' => esc_html__('Image', 'master-addons' ), |
| 74 |
'icon' => 'eicon-image', |
| 75 |
], |
| 76 |
] |
| 77 |
] |
| 78 |
); |
| 79 |
|
| 80 |
$repeater->add_control( |
| 81 |
'icon', |
| 82 |
[ |
| 83 |
'label' => esc_html__('Icon', 'master-addons' ), |
| 84 |
'type' => Controls_Manager::ICONS, |
| 85 |
'default' => [ |
| 86 |
'value' => 'fas fa-star', |
| 87 |
'library' => 'solid', |
| 88 |
], |
| 89 |
'condition' => [ |
| 90 |
'icon_type' => 'icon', |
| 91 |
], |
| 92 |
] |
| 93 |
); |
| 94 |
|
| 95 |
$repeater->add_control( |
| 96 |
'custom', |
| 97 |
[ |
| 98 |
'label' => esc_html__('Image', 'master-addons' ), |
| 99 |
'label_block' => true, |
| 100 |
'type' => Controls_Manager::MEDIA, |
| 101 |
'condition' => [ |
| 102 |
'icon_type' => 'custom', |
| 103 |
], |
| 104 |
] |
| 105 |
); |
| 106 |
|
| 107 |
$repeater->add_control( |
| 108 |
'title', |
| 109 |
[ |
| 110 |
'type' => Controls_Manager::TEXT, |
| 111 |
'label_block' => true, |
| 112 |
'label' => esc_html__('Title', 'master-addons' ), |
| 113 |
'default' => 'Type your title', |
| 114 |
] |
| 115 |
); |
| 116 |
|
| 117 |
$repeater->add_control( |
| 118 |
'number_prefix', |
| 119 |
[ |
| 120 |
'type' => Controls_Manager::TEXT, |
| 121 |
'label_block' => true, |
| 122 |
'label' => esc_html__('Number Prefix', 'master-addons' ), |
| 123 |
'placeholder' => '', |
| 124 |
'default' => '', |
| 125 |
] |
| 126 |
); |
| 127 |
|
| 128 |
$repeater->add_control( |
| 129 |
'number_suffix', |
| 130 |
[ |
| 131 |
'type' => Controls_Manager::TEXT, |
| 132 |
'label_block' => true, |
| 133 |
'label' => esc_html__('Number Suffix', 'master-addons' ), |
| 134 |
'default' => '+', |
| 135 |
] |
| 136 |
); |
| 137 |
|
| 138 |
$repeater->add_control( |
| 139 |
'number', |
| 140 |
[ |
| 141 |
'type' => Controls_Manager::NUMBER, |
| 142 |
'label' => esc_html__('Number', 'master-addons' ), |
| 143 |
'default' => 123456, |
| 144 |
] |
| 145 |
); |
| 146 |
|
| 147 |
$repeater->add_control( |
| 148 |
'background', |
| 149 |
[ |
| 150 |
'type' => Controls_Manager::COLOR, |
| 151 |
'label' => esc_html__('Background', 'master-addons' ) |
| 152 |
] |
| 153 |
); |
| 154 |
|
| 155 |
$this->add_control( |
| 156 |
'jltma_counterup_contents', |
| 157 |
[ |
| 158 |
'label' => esc_html__('Items', 'master-addons' ), |
| 159 |
'type' => Controls_Manager::REPEATER, |
| 160 |
'default' => [ |
| 161 |
[ |
| 162 |
'number' => 6000, |
| 163 |
'icon' => ['value' => 'far fa-thumbs-up', 'library' => 'regular'], |
| 164 |
'title' => esc_html__('Happy Clients', 'master-addons' ), |
| 165 |
'background' => '' |
| 166 |
], |
| 167 |
[ |
| 168 |
'number' => 9560, |
| 169 |
'icon' => ['value' => 'far fa-check-circle', 'library' => 'regular'], |
| 170 |
'title' => esc_html__('Projects Completed', 'master-addons' ), |
| 171 |
'background' => '' |
| 172 |
], |
| 173 |
[ |
| 174 |
'number' => 165893, |
| 175 |
'icon' => ['value' => 'fas fa-coffee', 'library' => 'solid'], |
| 176 |
'title' => esc_html__('Cups of Coffee', 'master-addons' ), |
| 177 |
'background' => '' |
| 178 |
], |
| 179 |
[ |
| 180 |
'number' => 12356789, |
| 181 |
'icon' => ['value' => 'fas fa-trophy', 'library' => 'solid'], |
| 182 |
'title' => esc_html__('Awards Won', 'master-addons' ), |
| 183 |
'background' => '' |
| 184 |
], |
| 185 |
], |
| 186 |
'fields' => $repeater->get_controls(), |
| 187 |
'title_field' => '{{title}}', |
| 188 |
] |
| 189 |
); |
| 190 |
|
| 191 |
$this->add_responsive_control( |
| 192 |
'column', |
| 193 |
[ |
| 194 |
'label' => esc_html__('Columns', 'master-addons' ), |
| 195 |
'type' => Controls_Manager::SELECT, |
| 196 |
'default' => 4, |
| 197 |
'options' => [ |
| 198 |
'6' => esc_html__('6 Columns', 'master-addons' ), |
| 199 |
'4' => esc_html__('4 Columns', 'master-addons' ), |
| 200 |
'3' => esc_html__('3 Columns', 'master-addons' ), |
| 201 |
'2' => esc_html__('2 Columns', 'master-addons' ), |
| 202 |
'1' => esc_html__('1 Column', 'master-addons' ), |
| 203 |
], |
| 204 |
'selectors' => [ |
| 205 |
'{{WRAPPER}} .jltma-counterup-column' => 'width: calc(100% / {{VALUE}});', |
| 206 |
], |
| 207 |
] |
| 208 |
); |
| 209 |
|
| 210 |
$this->end_controls_section(); |
| 211 |
|
| 212 |
$this->start_controls_section( |
| 213 |
'jltma_counterup_icons_section', |
| 214 |
[ |
| 215 |
'label' => esc_html__('Icon Settings', 'master-addons' ) |
| 216 |
] |
| 217 |
); |
| 218 |
|
| 219 |
// counnterup icon align |
| 220 |
$this->add_control( |
| 221 |
'jltma_counterup_icon_align', |
| 222 |
[ |
| 223 |
'label' => esc_html__('Icon/Image Position', 'master-addons' ), |
| 224 |
'type' => Controls_Manager::CHOOSE, |
| 225 |
'options' => [ |
| 226 |
'left' => [ |
| 227 |
'title' => esc_html__('Left', 'master-addons' ), |
| 228 |
'icon' => 'eicon-h-align-left', |
| 229 |
], |
| 230 |
'center' => [ |
| 231 |
'title' => esc_html__('Top', 'master-addons' ), |
| 232 |
'icon' => 'eicon-v-align-top', |
| 233 |
], |
| 234 |
'right' => [ |
| 235 |
'title' => esc_html__('Right', 'master-addons' ), |
| 236 |
'icon' => 'eicon-h-align-right', |
| 237 |
], |
| 238 |
], |
| 239 |
'default' => 'center', |
| 240 |
] |
| 241 |
); |
| 242 |
|
| 243 |
// Icon Size |
| 244 |
$this->add_control( |
| 245 |
'icon_size', |
| 246 |
[ |
| 247 |
'label' => esc_html__('Icon Size', 'master-addons' ), |
| 248 |
'type' => Controls_Manager::SLIDER, |
| 249 |
'range' => [ |
| 250 |
'px' => [ |
| 251 |
'min' => 6, |
| 252 |
'max' => 300, |
| 253 |
], |
| 254 |
], |
| 255 |
'default' => [ |
| 256 |
'size' => 30, |
| 257 |
], |
| 258 |
'selectors' => [ |
| 259 |
'{{WRAPPER}} .jltma-counterup .jltma-counterup-icon i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 260 |
'{{WRAPPER}} .jltma-counterup .jltma-counterup-icon img' => 'max-width: {{SIZE}}{{UNIT}};', |
| 261 |
], |
| 262 |
] |
| 263 |
); |
| 264 |
|
| 265 |
$this->add_control( |
| 266 |
'image_size', |
| 267 |
[ |
| 268 |
'label' => esc_html__('Icon Circle or Image Size', 'master-addons' ), |
| 269 |
'type' => Controls_Manager::SLIDER, |
| 270 |
'range' => [ |
| 271 |
'px' => [ |
| 272 |
'min' => 6, |
| 273 |
'max' => 300, |
| 274 |
], |
| 275 |
], |
| 276 |
'default' => [ |
| 277 |
'size' => 70, |
| 278 |
], |
| 279 |
'selectors' => [ |
| 280 |
'{{WRAPPER}} .jltma-counterup .jltma-counterup-icon i' => 'height: {{SIZE}}{{UNIT}};', |
| 281 |
'{{WRAPPER}} .jltma-counterup i' => 'width: {{SIZE}}{{UNIT}};', |
| 282 |
'{{WRAPPER}} .jltma-counterup .jltma-counterup-icon img' => 'max-width: {{SIZE}}{{UNIT}};', |
| 283 |
], |
| 284 |
] |
| 285 |
); |
| 286 |
|
| 287 |
$this->end_controls_section(); |
| 288 |
|
| 289 |
/** |
| 290 |
* ------------------------------------------- |
| 291 |
* counterup style |
| 292 |
* ------------------------------------------- |
| 293 |
*/ |
| 294 |
$this->start_controls_section( |
| 295 |
'jltma_counterup_box_style_section', |
| 296 |
[ |
| 297 |
'label' => esc_html__('Counter Up Box Style', 'master-addons' ), |
| 298 |
'tab' => Controls_Manager::TAB_STYLE |
| 299 |
] |
| 300 |
); |
| 301 |
|
| 302 |
// counterup background color |
| 303 |
$this->add_control( |
| 304 |
'jltma_counterup_bg_color', |
| 305 |
[ |
| 306 |
'label' => esc_html__('Background Color', 'master-addons' ), |
| 307 |
'type' => Controls_Manager::COLOR, |
| 308 |
'selectors' => [ |
| 309 |
'{{WRAPPER}} .jltma-counterup' => 'background-color: {{VALUE}};' |
| 310 |
], |
| 311 |
] |
| 312 |
); |
| 313 |
|
| 314 |
// counterup box padding |
| 315 |
$this->add_responsive_control( |
| 316 |
'jltma_counterup_padding', |
| 317 |
[ |
| 318 |
'label' => esc_html__('Padding', 'master-addons' ), |
| 319 |
'type' => Controls_Manager::DIMENSIONS, |
| 320 |
'size_units' => ['px', 'em', '%'], |
| 321 |
'selectors' => [ |
| 322 |
'{{WRAPPER}} .jltma-counterup' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 323 |
], |
| 324 |
] |
| 325 |
); |
| 326 |
|
| 327 |
// counterup margin |
| 328 |
$this->add_responsive_control( |
| 329 |
'jltma_counterup_margin', |
| 330 |
[ |
| 331 |
'label' => esc_html__('Margin', 'master-addons' ), |
| 332 |
'type' => Controls_Manager::DIMENSIONS, |
| 333 |
'size_units' => ['px', 'em', '%'], |
| 334 |
'selectors' => [ |
| 335 |
'{{WRAPPER}} .jltma-counterup' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 336 |
], |
| 337 |
] |
| 338 |
); |
| 339 |
|
| 340 |
// counterup border |
| 341 |
$this->add_group_control( |
| 342 |
Group_Control_Border::get_type(), |
| 343 |
[ |
| 344 |
'name' => 'jltma_counterup_border', |
| 345 |
'label' => esc_html__('Border Type', 'master-addons' ), |
| 346 |
'selector' => '{{WRAPPER}} .jltma-counterup', |
| 347 |
] |
| 348 |
); |
| 349 |
|
| 350 |
$this->add_responsive_control( |
| 351 |
'jltma_counterup_border_radius', |
| 352 |
[ |
| 353 |
'label' => esc_html__('Border Radius', 'master-addons' ), |
| 354 |
'type' => Controls_Manager::SLIDER, |
| 355 |
'size_units' => ['px', '%'], |
| 356 |
'range' => [ |
| 357 |
'px' => [ |
| 358 |
'min' => 0, |
| 359 |
'max' => 100, |
| 360 |
'step' => 1, |
| 361 |
], |
| 362 |
'%' => [ |
| 363 |
'min' => 0, |
| 364 |
'max' => 100, |
| 365 |
], |
| 366 |
], |
| 367 |
'selectors' => [ |
| 368 |
'{{WRAPPER}} .jltma-counterup' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 369 |
], |
| 370 |
] |
| 371 |
); |
| 372 |
|
| 373 |
// counterup box shadow |
| 374 |
$this->add_group_control( |
| 375 |
Group_Control_Box_Shadow::get_type(), |
| 376 |
[ |
| 377 |
'name' => 'jltma_counterup_box_shadow', |
| 378 |
'selector' => '{{WRAPPER}} .jltma-counterup-column .jltma-counterup' |
| 379 |
] |
| 380 |
); |
| 381 |
|
| 382 |
$this->end_controls_section(); |
| 383 |
|
| 384 |
/** |
| 385 |
* ------------------------------------------- |
| 386 |
* color & typography |
| 387 |
* ------------------------------------------- |
| 388 |
*/ |
| 389 |
$this->start_controls_section( |
| 390 |
'jltma_counterup_typography_section', |
| 391 |
[ |
| 392 |
'label' => esc_html__('Content Style', 'master-addons' ), |
| 393 |
'tab' => Controls_Manager::TAB_STYLE |
| 394 |
] |
| 395 |
); |
| 396 |
|
| 397 |
// counterup icon style |
| 398 |
$this->add_control( |
| 399 |
'jltma_counterup_icon_style', |
| 400 |
[ |
| 401 |
'label' => esc_html__('Icon Style', 'master-addons' ), |
| 402 |
'type' => Controls_Manager::HEADING |
| 403 |
] |
| 404 |
); |
| 405 |
|
| 406 |
// counterup icon color |
| 407 |
$this->add_control( |
| 408 |
'jltma_counterup_icon_color', |
| 409 |
[ |
| 410 |
'label' => esc_html__('Color', 'master-addons' ), |
| 411 |
'type' => Controls_Manager::COLOR, |
| 412 |
'default' => '#fff', |
| 413 |
'selectors' => [ |
| 414 |
'{{WRAPPER}} .jltma-counterup i' => 'color: {{VALUE}};', |
| 415 |
], |
| 416 |
] |
| 417 |
); |
| 418 |
|
| 419 |
// counterup icon color |
| 420 |
$this->add_control( |
| 421 |
'jltma_counterup_icon_bg_color', |
| 422 |
[ |
| 423 |
'label' => esc_html__('Background Color', 'master-addons' ), |
| 424 |
'type' => Controls_Manager::COLOR, |
| 425 |
'default' => '#4b00e7', |
| 426 |
'selectors' => [ |
| 427 |
'{{WRAPPER}} .jltma-counterup-icon i' => 'background-color: {{VALUE}};', |
| 428 |
], |
| 429 |
] |
| 430 |
); |
| 431 |
|
| 432 |
// counterup number style |
| 433 |
$this->add_control( |
| 434 |
'jltma_counterup_number_style', |
| 435 |
[ |
| 436 |
'label' => esc_html__('Number Style', 'master-addons' ), |
| 437 |
'type' => Controls_Manager::HEADING, |
| 438 |
'separator' => 'before' |
| 439 |
] |
| 440 |
); |
| 441 |
|
| 442 |
// counterup number color |
| 443 |
$this->add_control( |
| 444 |
'jltma_counterup_number_color', |
| 445 |
[ |
| 446 |
'type' => Controls_Manager::COLOR, |
| 447 |
'label' => esc_html__('Color', 'master-addons' ), |
| 448 |
'global' => [ |
| 449 |
'default' => Global_Colors::COLOR_PRIMARY, |
| 450 |
], |
| 451 |
'default' => '#333', |
| 452 |
'selectors' => [ |
| 453 |
'{{WRAPPER}} .jltma-counterup h3.jltma-counter-up-number' => 'color: {{VALUE}};' |
| 454 |
], |
| 455 |
] |
| 456 |
); |
| 457 |
|
| 458 |
// counterup number Prefix |
| 459 |
$this->add_control( |
| 460 |
'jltma_counterup_number_prefix_style', |
| 461 |
[ |
| 462 |
'label' => esc_html__('Number Prefix', 'master-addons' ), |
| 463 |
'type' => Controls_Manager::HEADING, |
| 464 |
'separator' => 'before' |
| 465 |
] |
| 466 |
); |
| 467 |
|
| 468 |
// counterup number color |
| 469 |
$this->add_control( |
| 470 |
'jltma_counterup_number_prefix_color', |
| 471 |
[ |
| 472 |
'type' => Controls_Manager::COLOR, |
| 473 |
'label' => esc_html__('Color', 'master-addons' ), |
| 474 |
'global' => [ |
| 475 |
'default' => Global_Colors::COLOR_PRIMARY, |
| 476 |
], |
| 477 |
'default' => '#333', |
| 478 |
'selectors' => [ |
| 479 |
'{{WRAPPER}} .jltma-counterup h3.jltma-counter-up-number-prefix' => 'color: {{VALUE}};' |
| 480 |
], |
| 481 |
] |
| 482 |
); |
| 483 |
|
| 484 |
// Counter Up number typography |
| 485 |
$this->add_control( |
| 486 |
'jltma_counterup_number_prefix_size', |
| 487 |
[ |
| 488 |
'label' => esc_html__('Size', 'master-addons' ), |
| 489 |
'type' => Controls_Manager::SLIDER, |
| 490 |
'selectors' => [ |
| 491 |
'{{WRAPPER}} .jltma-counterup h3.jltma-counter-up-number-prefix' => 'font-size: {{SIZE}}{{UNIT}};' |
| 492 |
] |
| 493 |
] |
| 494 |
); |
| 495 |
|
| 496 |
// counterup number margin |
| 497 |
$this->add_control( |
| 498 |
'jltma_counterup_number_margin', |
| 499 |
[ |
| 500 |
'label' => esc_html__('Margin', 'master-addons' ), |
| 501 |
'type' => Controls_Manager::DIMENSIONS, |
| 502 |
'size_units' => ['px', 'em', '%'], |
| 503 |
'selectors' => [ |
| 504 |
'{{WRAPPER}} .jltma-counterup h3.jltma-counter-up-number' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 505 |
], |
| 506 |
] |
| 507 |
); |
| 508 |
|
| 509 |
// counterup title style |
| 510 |
$this->add_control( |
| 511 |
'jltma_counterup_title_style', |
| 512 |
[ |
| 513 |
'label' => esc_html__('Title Style', 'master-addons' ), |
| 514 |
'type' => Controls_Manager::HEADING, |
| 515 |
'separator' => 'before' |
| 516 |
] |
| 517 |
); |
| 518 |
|
| 519 |
// counterup title color |
| 520 |
$this->add_control( |
| 521 |
'jltma_counterup_title_color', |
| 522 |
[ |
| 523 |
'type' => Controls_Manager::COLOR, |
| 524 |
'label' => esc_html__('Title color', 'master-addons' ), |
| 525 |
'global' => [ |
| 526 |
'default' => Global_Colors::COLOR_PRIMARY, |
| 527 |
], |
| 528 |
'default' => '#525151', |
| 529 |
'selectors' => [ |
| 530 |
'{{WRAPPER}} .jltma-counterup-title' => 'color: {{VALUE}};' |
| 531 |
], |
| 532 |
] |
| 533 |
); |
| 534 |
|
| 535 |
// counterup title typography |
| 536 |
$this->add_group_control( |
| 537 |
Group_Control_Typography::get_type(), |
| 538 |
[ |
| 539 |
'name' => 'jltma_counterup_title_typography', |
| 540 |
'global' => [ |
| 541 |
'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 542 |
], |
| 543 |
'selector' => '{{WRAPPER}} .jltma-counterup-title' |
| 544 |
] |
| 545 |
); |
| 546 |
|
| 547 |
// counterup title margin |
| 548 |
$this->add_control( |
| 549 |
'jltma_counterup_title_margin', |
| 550 |
[ |
| 551 |
'label' => esc_html__('Margin', 'master-addons' ), |
| 552 |
'type' => Controls_Manager::DIMENSIONS, |
| 553 |
'size_units' => ['px', 'em', '%'], |
| 554 |
'selectors' => [ |
| 555 |
'{{WRAPPER}} .jltma-counterup-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 556 |
], |
| 557 |
] |
| 558 |
); |
| 559 |
|
| 560 |
$this->end_controls_section(); |
| 561 |
|
| 562 |
// Help Docs section (links from config.php) |
| 563 |
$this->jltma_help_docs(); |
| 564 |
|
| 565 |
$this->upgrade_to_pro_message(); |
| 566 |
|
| 567 |
} |
| 568 |
|
| 569 |
protected function render() |
| 570 |
{ |
| 571 |
|
| 572 |
$settings = $this->get_settings_for_display(); |
| 573 |
$id_int = substr($this->get_id_int(), 0, 3); |
| 574 |
|
| 575 |
if (is_array($settings['jltma_counterup_contents'])) : |
| 576 |
echo '<div class="jltma-counterup-items jltma-row">'; |
| 577 |
|
| 578 |
foreach ($settings['jltma_counterup_contents'] as $index => $list) : |
| 579 |
|
| 580 |
$title_count = $index + 1; |
| 581 |
$title_settings_key = $this->get_repeater_setting_key('title', 'jltma_counterup_contents', $index); |
| 582 |
|
| 583 |
$this->add_render_attribute($title_settings_key, [ |
| 584 |
'id' => $id_int . $title_count, |
| 585 |
'style' => ['background-color:', $list['background']] |
| 586 |
]); |
| 587 |
|
| 588 |
echo '<div class="jltma-counterup-column">'; |
| 589 |
echo '<div class="jltma-counterup jltma-counterup-icon-' . esc_attr($settings['jltma_counterup_icon_align']) . '" ' . $this->get_render_attribute_string($title_settings_key) . '>'; |
| 590 |
echo '<span class="jltma-counterup-icon counterup-icon-text-' . esc_attr($settings['jltma_counterup_icon_align']) . '">'; |
| 591 |
|
| 592 |
if (!empty($list['icon']) && ($list['icon_type'] == 'icon')) { |
| 593 |
$this->render_icon($list['icon'], ['aria-hidden' => 'true']); |
| 594 |
}elseif(!empty($list['custom']) && ($list['icon_type'] == 'custom')){ |
| 595 |
$svg_src = wp_get_attachment_url($list["custom"]["id"], 'full'); |
| 596 |
echo '<img src="' . esc_url_raw($svg_src) . '"/>'; |
| 597 |
} |
| 598 |
|
| 599 |
echo '</span>'; |
| 600 |
if (!empty($list['number']) || ($list['title'])) : |
| 601 |
echo '<div class="jltma-counterup-content">'; |
| 602 |
$list['number'] ? printf('<div class="jltma-counter-up-number-section"><h3 class="jltma-counter-up-number-prefix">%1$s</h3><h3 class="jltma-counter-up-number">%2$s</h3><h3 class="jltma-counter-up-number-prefix">%3$s</h3></div>', $this->parse_text_editor($list['number_prefix']), esc_attr($list['number']), $this->parse_text_editor($list['number_suffix'])) : ''; |
| 603 |
$list['title'] ? printf('<span class="jltma-counterup-title">%s</span>', $this->parse_text_editor($list['title'])) : ''; |
| 604 |
echo '</div>'; |
| 605 |
endif; |
| 606 |
echo '</div>'; |
| 607 |
echo '</div>'; |
| 608 |
endforeach; |
| 609 |
echo '</div>'; |
| 610 |
endif; |
| 611 |
} |
| 612 |
} |
| 613 |
|