| 1 |
<?php |
| 2 |
namespace Easyel\EasyElements\Widgets; |
| 3 |
use Elementor\Utils; |
| 4 |
use Elementor\Controls_Manager; |
| 5 |
use Elementor\Responsive_Control; |
| 6 |
use Elementor\Group_Control_Image_Size; |
| 7 |
|
| 8 |
defined( 'ABSPATH' ) || die(); |
| 9 |
|
| 10 |
class Easyel_Process_lists_Widget extends \Elementor\Widget_Base { |
| 11 |
|
| 12 |
public function get_name() { |
| 13 |
return 'eel-process-list'; |
| 14 |
} |
| 15 |
|
| 16 |
public function get_title() { |
| 17 |
return esc_html__( 'Process List', 'easy-elements' ); |
| 18 |
} |
| 19 |
|
| 20 |
public function get_icon() { |
| 21 |
return 'easyicon easyelIcon-process-list'; |
| 22 |
} |
| 23 |
|
| 24 |
public function get_categories() { |
| 25 |
return [ 'easyelements_category' ]; |
| 26 |
} |
| 27 |
|
| 28 |
public function get_keywords() { |
| 29 |
return [ 'process', 'sevice', 'icon', 'process-box', 'text' ]; |
| 30 |
} |
| 31 |
|
| 32 |
public function get_style_depends() { |
| 33 |
return [ |
| 34 |
'eel-process-list', |
| 35 |
]; |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
protected function register_controls() { |
| 40 |
$this->start_controls_section( |
| 41 |
'_section_logo', |
| 42 |
[ |
| 43 |
'label' => esc_html__( 'Process Settings', 'easy-elements' ), |
| 44 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 45 |
] |
| 46 |
); |
| 47 |
|
| 48 |
$this->add_control( |
| 49 |
'icon', |
| 50 |
[ |
| 51 |
'label' => esc_html__( 'Icon', 'easy-elements' ), |
| 52 |
'type' => \Elementor\Controls_Manager::ICONS, |
| 53 |
'label_block' => true, |
| 54 |
'default' => [ |
| 55 |
'value' => 'fas fa-star', |
| 56 |
'library' => 'fa-solid', |
| 57 |
], |
| 58 |
] |
| 59 |
); |
| 60 |
|
| 61 |
$this->add_control( |
| 62 |
'process_title', |
| 63 |
[ |
| 64 |
'label' => esc_html__( 'Title', 'easy-elements' ), |
| 65 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 66 |
'default' => esc_html__( 'Initial Consultation', 'easy-elements' ), |
| 67 |
'label_block' => true, |
| 68 |
] |
| 69 |
); |
| 70 |
|
| 71 |
$this->add_control( |
| 72 |
'_description', |
| 73 |
[ |
| 74 |
'label' => esc_html__( 'Description', 'easy-elements' ), |
| 75 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 76 |
'default' => esc_html__( 'We start by understanding your vision, needs, lifestyle, and budget to establish the foundation of your project.', 'easy-elements' ), |
| 77 |
] |
| 78 |
); |
| 79 |
|
| 80 |
$this->add_control( |
| 81 |
'link', |
| 82 |
[ |
| 83 |
'label' => esc_html__('Link', 'easy-elements'), |
| 84 |
'type' => Controls_Manager::URL, |
| 85 |
'placeholder' => 'https://example.com', |
| 86 |
] |
| 87 |
); |
| 88 |
|
| 89 |
$this->add_control( |
| 90 |
'process_number', |
| 91 |
[ |
| 92 |
'label' => esc_html__( 'Process Number', 'easy-elements' ), |
| 93 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 94 |
'default' => '01', |
| 95 |
'placeholder' => 'Enter a number', |
| 96 |
] |
| 97 |
); |
| 98 |
|
| 99 |
$this->add_control( |
| 100 |
'title_tag', |
| 101 |
[ |
| 102 |
'label' => esc_html__( 'Title HTML Tag', 'easy-elements' ), |
| 103 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 104 |
'default' => 'h3', |
| 105 |
'options' => [ |
| 106 |
'h1' => 'H1', |
| 107 |
'h2' => 'H2', |
| 108 |
'h3' => 'H3', |
| 109 |
'h4' => 'H4', |
| 110 |
'h5' => 'H5', |
| 111 |
'h6' => 'H6', |
| 112 |
'div' => 'div', |
| 113 |
'span' => 'span', |
| 114 |
'p' => 'p', |
| 115 |
], |
| 116 |
] |
| 117 |
); |
| 118 |
|
| 119 |
$this->add_responsive_control( |
| 120 |
'flex_align_vertical', |
| 121 |
[ |
| 122 |
'label' => esc_html__( 'Vertical Align', 'easy-elements' ), |
| 123 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 124 |
'options' => [ |
| 125 |
'flex-start' => [ |
| 126 |
'title' => esc_html__( 'Top', 'easy-elements' ), |
| 127 |
'icon' => 'eicon-v-align-top', |
| 128 |
], |
| 129 |
'center' => [ |
| 130 |
'title' => esc_html__( 'Center', 'easy-elements' ), |
| 131 |
'icon' => 'eicon-v-align-middle', |
| 132 |
], |
| 133 |
'flex-end' => [ |
| 134 |
'title' => esc_html__( 'Bottom', 'easy-elements' ), |
| 135 |
'icon' => 'eicon-v-align-bottom', |
| 136 |
], |
| 137 |
], |
| 138 |
'default' => 'center', |
| 139 |
'toggle' => true, |
| 140 |
'selectors' => [ |
| 141 |
'{{WRAPPER}} .eel--process-list' => 'align-items: {{VALUE}};', |
| 142 |
], |
| 143 |
] |
| 144 |
); |
| 145 |
|
| 146 |
$this->add_responsive_control( |
| 147 |
'item_gap', |
| 148 |
[ |
| 149 |
'label' => esc_html__( 'Gap', 'easy-elements' ), |
| 150 |
'type' => \Elementor\Controls_Manager::SLIDER, |
| 151 |
'size_units' => [ 'px', 'em', 'rem' ], |
| 152 |
'range' => [ |
| 153 |
'px' => [ |
| 154 |
'min' => 0, |
| 155 |
'max' => 100, |
| 156 |
'step' => 1, |
| 157 |
], |
| 158 |
'em' => [ |
| 159 |
'min' => 0, |
| 160 |
'max' => 10, |
| 161 |
'step' => 0.1, |
| 162 |
], |
| 163 |
], |
| 164 |
'default' => [ |
| 165 |
'size' => 64, |
| 166 |
'unit' => 'px', |
| 167 |
], |
| 168 |
'selectors' => [ |
| 169 |
'{{WRAPPER}} .eel--process-list' => 'gap: {{SIZE}}{{UNIT}};', |
| 170 |
], |
| 171 |
] |
| 172 |
); |
| 173 |
|
| 174 |
$this->end_controls_section(); |
| 175 |
|
| 176 |
$this->start_controls_section( |
| 177 |
'section_style_icon', |
| 178 |
[ |
| 179 |
'label' => esc_html__( 'Icon', 'easy-elements' ), |
| 180 |
'tab' => Controls_Manager::TAB_STYLE, |
| 181 |
] |
| 182 |
); |
| 183 |
|
| 184 |
$this->add_control( |
| 185 |
'icon_color', |
| 186 |
[ |
| 187 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 188 |
'type' => Controls_Manager::COLOR, |
| 189 |
'selectors' => [ |
| 190 |
'{{WRAPPER}} .eel--process-list .eel-process-icon' => 'color: {{VALUE}};', |
| 191 |
'{{WRAPPER}} .eel--process-list .eel-process-icon svg' => 'fill: {{VALUE}};', |
| 192 |
], |
| 193 |
] |
| 194 |
); |
| 195 |
|
| 196 |
$this->add_control( |
| 197 |
'icon_bg_color', |
| 198 |
[ |
| 199 |
'label' => esc_html__( 'Background', 'easy-elements' ), |
| 200 |
'type' => Controls_Manager::COLOR, |
| 201 |
'selectors' => [ |
| 202 |
'{{WRAPPER}} .eel--process-list .eel-process-icon' => 'background-color: {{VALUE}};', |
| 203 |
], |
| 204 |
] |
| 205 |
); |
| 206 |
|
| 207 |
$this->add_group_control( |
| 208 |
\Elementor\Group_Control_Background::get_type(), |
| 209 |
[ |
| 210 |
'name' => 'icon_background', |
| 211 |
'label' => esc_html__( 'Background', 'easy-elements' ), |
| 212 |
'types' => [ 'classic', 'gradient' ], |
| 213 |
'selector' => '{{WRAPPER}} .eel--process-list .eel-process-icon', |
| 214 |
] |
| 215 |
); |
| 216 |
|
| 217 |
$this->add_responsive_control( |
| 218 |
'icon_size', |
| 219 |
[ |
| 220 |
'label' => esc_html__( 'Icon Size', 'easy-elements' ), |
| 221 |
'type' => \Elementor\Controls_Manager::SLIDER, |
| 222 |
'range' => [ |
| 223 |
'px' => [ |
| 224 |
'min' => 10, |
| 225 |
'max' => 76, |
| 226 |
'step' => 1, |
| 227 |
], |
| 228 |
], |
| 229 |
'selectors' => [ |
| 230 |
'{{WRAPPER}} .eel--process-list .eel-process-icon svg' => 'width: {{SIZE}}{{UNIT}};', |
| 231 |
'{{WRAPPER}} .eel--process-list .eel-process-icon i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 232 |
], |
| 233 |
] |
| 234 |
); |
| 235 |
|
| 236 |
|
| 237 |
$this->add_group_control( |
| 238 |
\Elementor\Group_Control_Border::get_type(), |
| 239 |
[ |
| 240 |
'name' => 'icon_border', |
| 241 |
'selector' => '{{WRAPPER}} .eel--process-list .eel-process-icon', |
| 242 |
] |
| 243 |
); |
| 244 |
|
| 245 |
$this->add_control( |
| 246 |
'icon__border_radius', |
| 247 |
[ |
| 248 |
'label' => esc_html__( 'Border Radius', 'easy-elements' ), |
| 249 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 250 |
'size_units' => [ 'px', '%' ], |
| 251 |
'selectors' => [ |
| 252 |
'{{WRAPPER}} .eel--process-list .eel-process-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 253 |
], |
| 254 |
] |
| 255 |
); |
| 256 |
|
| 257 |
$this->add_responsive_control( |
| 258 |
'icon_padding', |
| 259 |
[ |
| 260 |
'label' => esc_html__( 'Padding', 'easy-elements' ), |
| 261 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 262 |
'size_units' => [ 'px', 'em', '%', 'rem' ], |
| 263 |
'selectors' => [ |
| 264 |
'{{WRAPPER}} .eel--process-list .eel-process-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 265 |
], |
| 266 |
] |
| 267 |
); |
| 268 |
|
| 269 |
$this->add_group_control( |
| 270 |
\Elementor\Group_Control_Box_Shadow::get_type(), |
| 271 |
[ |
| 272 |
'name' => 'icon_box_shadow', |
| 273 |
'label' => esc_html__( 'Box Shadow', 'easy-elements' ), |
| 274 |
'selector' => '{{WRAPPER}} .eel--process-list .eel-process-icon', |
| 275 |
] |
| 276 |
); |
| 277 |
|
| 278 |
$this->add_responsive_control( |
| 279 |
'icon_box_size', |
| 280 |
[ |
| 281 |
'label' => esc_html__( 'Box Size', 'easy-elements' ), |
| 282 |
'type' => Controls_Manager::SLIDER, |
| 283 |
'range' => [ |
| 284 |
'px' => [ |
| 285 |
'min' => 30, |
| 286 |
'max' => 150, |
| 287 |
], |
| 288 |
], |
| 289 |
'selectors' => [ |
| 290 |
'{{WRAPPER}} .eel--process-list .eel-process-icon' => 'width: {{SIZE}}{{UNIT}}; min-width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 291 |
], |
| 292 |
] |
| 293 |
); |
| 294 |
|
| 295 |
$this->end_controls_section(); |
| 296 |
|
| 297 |
$this->start_controls_section( |
| 298 |
'section_style_title', |
| 299 |
[ |
| 300 |
'label' => esc_html__( 'Title', 'easy-elements' ), |
| 301 |
'tab' => Controls_Manager::TAB_STYLE, |
| 302 |
] |
| 303 |
); |
| 304 |
|
| 305 |
$this->add_control( |
| 306 |
'title_color', |
| 307 |
[ |
| 308 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 309 |
'type' => Controls_Manager::COLOR, |
| 310 |
'selectors' => [ |
| 311 |
'{{WRAPPER}} .icon-box-title' => 'color: {{VALUE}};', |
| 312 |
], |
| 313 |
] |
| 314 |
); |
| 315 |
|
| 316 |
$this->add_group_control( |
| 317 |
\Elementor\Group_Control_Typography::get_type(), |
| 318 |
[ |
| 319 |
'name' => 'box_title_typography', |
| 320 |
'label' => esc_html__( 'Typography', 'easy-elements' ), |
| 321 |
'selector' => '{{WRAPPER}} .icon-box-title', |
| 322 |
] |
| 323 |
); |
| 324 |
|
| 325 |
$this->add_responsive_control( |
| 326 |
'title_margin', |
| 327 |
[ |
| 328 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 329 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 330 |
'size_units' => [ 'px', '%', 'em', 'rem' ], |
| 331 |
'selectors' => [ |
| 332 |
'{{WRAPPER}} .eel--process-list .icon-box-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 333 |
], |
| 334 |
] |
| 335 |
); |
| 336 |
|
| 337 |
$this->end_controls_section(); |
| 338 |
|
| 339 |
$this->start_controls_section( |
| 340 |
'title_sub_style',[ |
| 341 |
'label' => esc_html__( 'Highlight Title', 'easy-elements' ), |
| 342 |
'tab' => Controls_Manager::TAB_STYLE, |
| 343 |
] |
| 344 |
); |
| 345 |
|
| 346 |
$this->add_control( |
| 347 |
'title_highlight_note', |
| 348 |
[ |
| 349 |
'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 350 |
'raw' => __( 'Highlight options work only when part of the title is wrapped in a <span> tag.', 'easy-elements' ), |
| 351 |
'content_classes' => 'elementor-control-field-description', |
| 352 |
] |
| 353 |
); |
| 354 |
|
| 355 |
$this->add_control( |
| 356 |
'title_sub_color', |
| 357 |
[ |
| 358 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 359 |
'type' => Controls_Manager::COLOR, |
| 360 |
'selectors' => [ |
| 361 |
'{{WRAPPER}} .icon-box-title span' => 'color: {{VALUE}};', |
| 362 |
], |
| 363 |
] |
| 364 |
); |
| 365 |
|
| 366 |
$this->add_group_control( |
| 367 |
\Elementor\Group_Control_Typography::get_type(), |
| 368 |
[ |
| 369 |
'name' => 'title_sub_typography', |
| 370 |
'label' => esc_html__( 'Typography', 'easy-elements' ), |
| 371 |
'selector' => '{{WRAPPER}} .icon-box-title span', |
| 372 |
] |
| 373 |
); |
| 374 |
|
| 375 |
$this->add_responsive_control( |
| 376 |
'title_sub_margin', |
| 377 |
[ |
| 378 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 379 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 380 |
'size_units' => [ 'px', '%', 'em', 'rem' ], |
| 381 |
'selectors' => [ |
| 382 |
'{{WRAPPER}} .eel--process-list .icon-box-title span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 383 |
], |
| 384 |
] |
| 385 |
); |
| 386 |
|
| 387 |
$this->end_controls_section(); |
| 388 |
|
| 389 |
$this->start_controls_section( |
| 390 |
'section_style_description', |
| 391 |
[ |
| 392 |
'label' => esc_html__( 'Description', 'easy-elements' ), |
| 393 |
'tab' => Controls_Manager::TAB_STYLE, |
| 394 |
] |
| 395 |
); |
| 396 |
|
| 397 |
$this->add_control( |
| 398 |
'desc_color', |
| 399 |
[ |
| 400 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 401 |
'type' => Controls_Manager::COLOR, |
| 402 |
'selectors' => [ |
| 403 |
'{{WRAPPER}} .icon-box-description' => 'color: {{VALUE}};', |
| 404 |
], |
| 405 |
] |
| 406 |
); |
| 407 |
|
| 408 |
$this->add_group_control( |
| 409 |
\Elementor\Group_Control_Typography::get_type(), |
| 410 |
[ |
| 411 |
'name' => 'box_desc_typography', |
| 412 |
'label' => esc_html__( 'Typography', 'easy-elements' ), |
| 413 |
'selector' => '{{WRAPPER}} .icon-box-description', |
| 414 |
] |
| 415 |
); |
| 416 |
|
| 417 |
$this->end_controls_section(); |
| 418 |
|
| 419 |
$this->start_controls_section( |
| 420 |
'section_process_number', |
| 421 |
[ |
| 422 |
'label' => esc_html__( 'Number', 'easy-elements' ), |
| 423 |
'tab' => Controls_Manager::TAB_STYLE, |
| 424 |
] |
| 425 |
); |
| 426 |
|
| 427 |
$this->add_control( |
| 428 |
'process_number_color', |
| 429 |
[ |
| 430 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 431 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 432 |
'selectors' => [ |
| 433 |
'{{WRAPPER}} .eel-pro-number' => 'color: {{VALUE}};', |
| 434 |
], |
| 435 |
] |
| 436 |
); |
| 437 |
|
| 438 |
$this->add_group_control( |
| 439 |
\Elementor\Group_Control_Typography::get_type(), |
| 440 |
[ |
| 441 |
'name' => 'number_typography', |
| 442 |
'label' => esc_html__( 'Typography', 'easy-elements' ), |
| 443 |
'selector' => '{{WRAPPER}} .eel-pro-number', |
| 444 |
] |
| 445 |
); |
| 446 |
|
| 447 |
$this->end_controls_section(); |
| 448 |
} |
| 449 |
|
| 450 |
protected function render() { |
| 451 |
$settings = $this->get_settings_for_display(); |
| 452 |
$link = $settings['link']['url'] ?? ''; |
| 453 |
$target = ! empty( $settings['link']['is_external'] ) ? ' target="_blank"' : ''; |
| 454 |
$nofollow = ! empty( $settings['link']['nofollow'] ) ? ' rel="nofollow"' : ''; |
| 455 |
?> |
| 456 |
<div class="eel-process-wrap-list"> |
| 457 |
<?php if ( $link ) : ?> |
| 458 |
<a href="<?php echo esc_url( $link ); ?>" <?php echo esc_attr( $target ); ?> <?php echo esc_attr( $nofollow ); ?>> |
| 459 |
<?php endif; ?> |
| 460 |
<div class="eel--process-list"> |
| 461 |
<?php if ( ! empty( $settings['process_number'] ) ) : ?> |
| 462 |
<span class="eel-pro-number"><?php echo esc_html( $settings['process_number'] ); ?></span> |
| 463 |
<?php endif; ?> |
| 464 |
|
| 465 |
<?php |
| 466 |
if ( isset( $settings['icon']['value'] ) && ! empty( $settings['icon']['value'] ) ) { ?> |
| 467 |
<span class="eel-process-icon"><?php \Elementor\Icons_Manager::render_icon( $settings['icon'], [ 'aria-hidden' => 'true' ] ); ?></span> |
| 468 |
<?php } ?> |
| 469 |
|
| 470 |
<div class="eel-process-wrap"> |
| 471 |
<?php if ( ! empty( $settings['process_title'] ) ) : |
| 472 |
$title_tag = isset( $settings['title_tag'] ) ? $settings['title_tag'] : 'h3'; ?> |
| 473 |
<<?php echo esc_attr( $title_tag ); ?> class="icon-box-title"> |
| 474 |
<?php |
| 475 |
$allowed_tags = wp_kses_allowed_html('post'); |
| 476 |
echo wp_kses( $settings['process_title'], $allowed_tags ); |
| 477 |
?> |
| 478 |
</<?php echo esc_attr( $title_tag ); ?>> |
| 479 |
<?php endif; ?> |
| 480 |
|
| 481 |
<?php if ( ! empty( $settings['_description'] ) ) : ?> |
| 482 |
<div class="icon-box-description"><?php echo wp_kses_post( $settings['_description'] ); ?></div> |
| 483 |
<?php endif; ?> |
| 484 |
</div> |
| 485 |
</div> |
| 486 |
<?php if ( $link ) : ?> |
| 487 |
</a> |
| 488 |
<?php endif; ?> |
| 489 |
</div> |
| 490 |
<?php |
| 491 |
} |
| 492 |
} |