templates
1 year ago
Accordion.php
1 year ago
Alerts_Box.php
1 year ago
Animated_Heading.php
1 year ago
Before_after.php
1 year ago
Blog_Grid.php
1 year ago
Buttons.php
1 year ago
Cheat_sheet.php
1 year ago
Counter.php
1 year ago
Fullscreen_Slider.php
1 year ago
Icon_box.php
1 year ago
Instagram.php
1 year ago
Integrations.php
1 year ago
List_Item.php
1 year ago
Pricing_Table_Switcher.php
1 year ago
Pricing_Table_Tabs.php
1 year ago
Tabs.php
1 year ago
Team_Carousel.php
1 year ago
Testimonial.php
1 year ago
Timeline.php
1 year ago
Video_Playlist.php
1 year ago
Video_Popup.php
1 year ago
List_Item.php
429 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Use namespace to avoid conflict |
| 4 | */ |
| 5 | |
| 6 | namespace SPEL\Widgets; |
| 7 | |
| 8 | use Elementor\Group_Control_Border; |
| 9 | use Elementor\Group_Control_Box_Shadow; |
| 10 | use Elementor\Repeater; |
| 11 | use Elementor\Widget_Base; |
| 12 | use Elementor\Controls_Manager; |
| 13 | use Elementor\Group_Control_Typography; |
| 14 | |
| 15 | // Exit if accessed directly |
| 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | exit; |
| 18 | } |
| 19 | |
| 20 | |
| 21 | /** |
| 22 | * Class Alerts_box |
| 23 | * @package spider\Widgets |
| 24 | * @since 1.0.0 |
| 25 | */ |
| 26 | class List_Item extends Widget_Base { |
| 27 | public function get_name() { |
| 28 | return 'docly_list_item'; // ID of the widget (Don't change this name) |
| 29 | } |
| 30 | |
| 31 | public function get_title() { |
| 32 | return esc_html__( 'List Items', 'spider-elements' ); |
| 33 | } |
| 34 | |
| 35 | public function get_icon() { |
| 36 | return 'eicon-bullet-list spel-icon'; |
| 37 | } |
| 38 | |
| 39 | public function get_keywords() { |
| 40 | return [ 'spider', 'spider elements', 'icon list', 'icon', 'list' ]; |
| 41 | } |
| 42 | |
| 43 | public function get_categories() { |
| 44 | return [ 'spider-elements' ]; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Name: get_style_depends() |
| 49 | * Desc: Register the required CSS dependencies for the frontend. |
| 50 | */ |
| 51 | public function get_style_depends() { |
| 52 | return [ 'elegant-icon', 'spel-main' ]; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Name: register_controls() |
| 57 | * Desc: Register controls for these widgets |
| 58 | * Params: no params |
| 59 | * Return: @void |
| 60 | * Since: @1.0.0 |
| 61 | * Package: @spider-elements |
| 62 | * Author: spider-themes |
| 63 | */ |
| 64 | protected function register_controls() { |
| 65 | $this->elementor_content_control(); |
| 66 | $this->elementor_style_control(); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Name: elementor_content_control() |
| 71 | * Desc: Register the Content Tab output on the Elementor editor. |
| 72 | * Params: no params |
| 73 | * Return: @void |
| 74 | * Since: @1.0.0 |
| 75 | * Package: @spider-elements |
| 76 | * Author: spider-themes |
| 77 | */ |
| 78 | public function elementor_content_control() { |
| 79 | |
| 80 | |
| 81 | //============================ Icon List ============================// |
| 82 | $this->start_controls_section( |
| 83 | 'section_icon', [ |
| 84 | 'label' => esc_html__( 'Icon List', 'spider-elements' ), |
| 85 | ] |
| 86 | ); |
| 87 | |
| 88 | $this->add_control( |
| 89 | 'style', [ |
| 90 | 'label' => esc_html__( 'Order Type', 'spider-elements' ), |
| 91 | 'type' => Controls_Manager::SELECT, |
| 92 | 'options' => [ |
| 93 | 'unordered_list' => esc_html__( 'Unordered List', 'spider-elements' ), |
| 94 | 'order_list' => esc_html__( 'Ordered List', 'spider-elements' ), |
| 95 | ], |
| 96 | 'default' => 'unordered_list', |
| 97 | ] |
| 98 | ); |
| 99 | |
| 100 | $repeater = new Repeater(); |
| 101 | $repeater->add_control( |
| 102 | 'text', [ |
| 103 | 'label' => esc_html__( 'Title', 'spider-elements' ), |
| 104 | 'type' => Controls_Manager::TEXTAREA, |
| 105 | 'label_block' => true, |
| 106 | 'placeholder' => esc_html__( 'List Item', 'spider-elements' ), |
| 107 | 'default' => esc_html__( 'List Item', 'spider-elements' ), |
| 108 | 'dynamic' => [ |
| 109 | 'active' => true, |
| 110 | ], |
| 111 | ] |
| 112 | ); |
| 113 | |
| 114 | $this->add_control( |
| 115 | 'ul_icon_list', [ |
| 116 | 'label' => 'Icon List', |
| 117 | 'type' => Controls_Manager::REPEATER, |
| 118 | 'fields' => $repeater->get_controls(), |
| 119 | 'title_field' => '{{{ text }}}', |
| 120 | 'prevent_empty' => false, |
| 121 | ] |
| 122 | ); |
| 123 | |
| 124 | $this->end_controls_section(); // End Icon List |
| 125 | |
| 126 | } |
| 127 | |
| 128 | |
| 129 | /** |
| 130 | * Name: elementor_style_control() |
| 131 | * Desc: Register the Style Tab output on the Elementor editor. |
| 132 | * Params: no params |
| 133 | * Return: @void |
| 134 | * Since: @1.0.0 |
| 135 | * Package: @spider-elements |
| 136 | * Author: spider-themes |
| 137 | */ |
| 138 | public function elementor_style_control() { |
| 139 | |
| 140 | |
| 141 | //============================ List Item ============================// |
| 142 | $this->start_controls_section( |
| 143 | 'section_icon_list', [ |
| 144 | 'label' => esc_html__( 'List', 'spider-elements' ), |
| 145 | 'tab' => Controls_Manager::TAB_STYLE, |
| 146 | ] |
| 147 | ); |
| 148 | |
| 149 | $this->add_responsive_control( |
| 150 | 'space_between', [ |
| 151 | 'label' => esc_html__( 'Space Between', 'spider-elements' ), |
| 152 | 'type' => Controls_Manager::SLIDER, |
| 153 | 'range' => [ |
| 154 | 'px' => [ |
| 155 | 'max' => 100, |
| 156 | ], |
| 157 | ], |
| 158 | 'selectors' => [ |
| 159 | '{{WRAPPER}} .steps-panel .ordered-list li:not(.steps-panel .ordered-list li:last-child)' => 'padding-bottom: {{SIZE}}{{UNIT}}', |
| 160 | ], |
| 161 | ] |
| 162 | ); |
| 163 | |
| 164 | $this->add_control( |
| 165 | 'text_indent', [ |
| 166 | 'label' => esc_html__( 'Text Indent', 'spider-elements' ), |
| 167 | 'type' => Controls_Manager::SLIDER, |
| 168 | 'range' => [ |
| 169 | 'px' => [ |
| 170 | 'max' => 100, |
| 171 | ], |
| 172 | ], |
| 173 | 'selectors' => [ |
| 174 | '{{WRAPPER}} .steps-panel .ordered-list li' => is_rtl() ? 'padding-right: {{SIZE}}{{UNIT}};' : 'padding-left: {{SIZE}}{{UNIT}};', |
| 175 | ], |
| 176 | ] |
| 177 | ); |
| 178 | |
| 179 | $this->add_responsive_control( |
| 180 | 'icon_align', [ |
| 181 | 'label' => esc_html__( 'Alignment', 'spider-elements' ), |
| 182 | 'type' => Controls_Manager::CHOOSE, |
| 183 | 'separator' => 'after', |
| 184 | 'options' => [ |
| 185 | 'left' => [ |
| 186 | 'title' => esc_html__( 'Left', 'spider-elements' ), |
| 187 | 'icon' => 'eicon-h-align-left', |
| 188 | ], |
| 189 | 'center' => [ |
| 190 | 'title' => esc_html__( 'Center', 'spider-elements' ), |
| 191 | 'icon' => 'eicon-h-align-center', |
| 192 | ], |
| 193 | 'right' => [ |
| 194 | 'title' => esc_html__( 'Right', 'spider-elements' ), |
| 195 | 'icon' => 'eicon-h-align-right', |
| 196 | ], |
| 197 | ], |
| 198 | 'prefix_class' => 'elementor%s-align-', |
| 199 | ] |
| 200 | ); |
| 201 | |
| 202 | $this->add_group_control( |
| 203 | Group_Control_Typography::get_type(), [ |
| 204 | 'name' => 'content_typography', |
| 205 | 'selector' => '{{WRAPPER}} .steps-panel .ordered-list li', |
| 206 | ] |
| 207 | ); |
| 208 | |
| 209 | $this->add_control( |
| 210 | 'text_color', [ |
| 211 | 'label' => esc_html__( 'Normal Color', 'spider-elements' ), |
| 212 | 'type' => Controls_Manager::COLOR, |
| 213 | 'default' => '', |
| 214 | 'selectors' => [ |
| 215 | '{{WRAPPER}} .steps-panel .ordered-list li' => 'color: {{VALUE}};', |
| 216 | ], |
| 217 | ] |
| 218 | ); |
| 219 | |
| 220 | $this->add_control( |
| 221 | 'text_color_hover', [ |
| 222 | 'label' => esc_html__( 'Hover Color', 'spider-elements' ), |
| 223 | 'type' => Controls_Manager::COLOR, |
| 224 | 'default' => '', |
| 225 | 'selectors' => [ |
| 226 | '{{WRAPPER}} .steps-panel .ordered-list li:hover' => 'color: {{VALUE}};', |
| 227 | ], |
| 228 | ] |
| 229 | ); |
| 230 | |
| 231 | $this->end_controls_section(); |
| 232 | |
| 233 | |
| 234 | //============================ Style Icon ============================// |
| 235 | $this->start_controls_section( |
| 236 | 'style_icon', [ |
| 237 | 'label' => esc_html__( 'Icon', 'spider-elements' ), |
| 238 | 'tab' => Controls_Manager::TAB_STYLE, |
| 239 | ] |
| 240 | ); |
| 241 | |
| 242 | $this->add_control( |
| 243 | 'icon_color', [ |
| 244 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 245 | 'type' => Controls_Manager::COLOR, |
| 246 | 'default' => '', |
| 247 | 'selectors' => [ |
| 248 | '{{WRAPPER}} .steps-panel .ordered-list li::before' => 'color: {{VALUE}};', |
| 249 | ], |
| 250 | ] |
| 251 | ); |
| 252 | |
| 253 | $this->add_control( |
| 254 | 'icon_bg_color', [ |
| 255 | 'label' => esc_html__( 'Background', 'spider-elements' ), |
| 256 | 'type' => Controls_Manager::COLOR, |
| 257 | 'default' => '', |
| 258 | 'selectors' => [ |
| 259 | '{{WRAPPER}} .steps-panel .ordered-list li::before' => 'background: {{VALUE}};', |
| 260 | ], |
| 261 | ] |
| 262 | ); |
| 263 | |
| 264 | $this->add_responsive_control( |
| 265 | 'icon_size', [ |
| 266 | 'label' => esc_html__( 'Size', 'spider-elements' ), |
| 267 | 'type' => Controls_Manager::SLIDER, |
| 268 | 'range' => [ |
| 269 | 'px' => [ |
| 270 | 'min' => 6, |
| 271 | ], |
| 272 | ], |
| 273 | 'selectors' => [ |
| 274 | '{{WRAPPER}} .steps-panel .ordered-list li::before' => 'font-size: {{SIZE}}{{UNIT}};', |
| 275 | ], |
| 276 | ] |
| 277 | ); |
| 278 | |
| 279 | $this->add_responsive_control( |
| 280 | 'icon_bg_size', [ |
| 281 | 'label' => esc_html__( 'Background Size', 'spider-elements' ), |
| 282 | 'type' => Controls_Manager::SLIDER, |
| 283 | 'range' => [ |
| 284 | 'px' => [ |
| 285 | 'min' => 6, |
| 286 | ], |
| 287 | ], |
| 288 | 'selectors' => [ |
| 289 | '{{WRAPPER}} .steps-panel .ordered-list li::before' => 'width:{{SIZE}}{{UNIT}} !important; height: {{SIZE}}{{UNIT}} !important;', |
| 290 | ], |
| 291 | ] |
| 292 | ); |
| 293 | |
| 294 | $this->add_responsive_control( |
| 295 | 'icon_line_height', [ |
| 296 | 'label' => esc_html__( 'Line Height', 'spider-elements' ), |
| 297 | 'type' => Controls_Manager::SLIDER, |
| 298 | 'range' => [ |
| 299 | 'px' => [ |
| 300 | 'min' => 6, |
| 301 | ], |
| 302 | ], |
| 303 | 'selectors' => [ |
| 304 | '{{WRAPPER}} .steps-panel .ordered-list li::before' => 'line-height: {{SIZE}}{{UNIT}};', |
| 305 | ], |
| 306 | ] |
| 307 | ); |
| 308 | |
| 309 | $this->end_controls_section(); // End Style Icon |
| 310 | |
| 311 | |
| 312 | //============================ Style Background ============================// |
| 313 | $this->start_controls_section( |
| 314 | 'sec_bg_style', [ |
| 315 | 'label' => esc_html__( 'Background', 'spider-elements' ), |
| 316 | 'tab' => Controls_Manager::TAB_STYLE, |
| 317 | ] |
| 318 | ); |
| 319 | |
| 320 | $this->add_group_control( |
| 321 | \Elementor\Group_Control_Background::get_type(), |
| 322 | [ |
| 323 | 'name' => 'list_background', |
| 324 | 'types' => [ 'classic', 'gradient' ], |
| 325 | 'selector' => '{{WRAPPER}} .steps-panel', |
| 326 | ] |
| 327 | ); |
| 328 | |
| 329 | $this->add_group_control( |
| 330 | Group_Control_Box_Shadow::get_type(), [ |
| 331 | 'name' => 'sec_box_shadow', |
| 332 | 'selector' => '{{WRAPPER}} .steps-panel', |
| 333 | ] |
| 334 | ); |
| 335 | |
| 336 | $this->add_responsive_control( |
| 337 | 'sec_margin', [ |
| 338 | 'label' => esc_html__( 'Padding', 'spider-elements' ), |
| 339 | 'type' => Controls_Manager::DIMENSIONS, |
| 340 | 'size_units' => [ 'px', '%', 'em' ], |
| 341 | 'selectors' => [ |
| 342 | '{{WRAPPER}} .steps-panel' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 343 | ], |
| 344 | 'default' => [ |
| 345 | 'unit' => 'px', // The selected CSS Unit. 'px', '%', 'em', |
| 346 | ], |
| 347 | ] |
| 348 | ); |
| 349 | |
| 350 | $this->add_group_control( |
| 351 | Group_Control_Border::get_type(), [ |
| 352 | 'name' => 'border', |
| 353 | 'label' => esc_html__( 'Border', 'spider-elements' ), |
| 354 | 'selector' => '{{WRAPPER}} .steps-panel', |
| 355 | 'separator' => 'before', |
| 356 | ] |
| 357 | ); |
| 358 | |
| 359 | $this->add_control( |
| 360 | 'border_radius', [ |
| 361 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 362 | 'type' => Controls_Manager::DIMENSIONS, |
| 363 | 'size_units' => [ 'px', '%' ], |
| 364 | 'selectors' => [ |
| 365 | '{{WRAPPER}} .steps-panel' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 366 | ], |
| 367 | ] |
| 368 | ); |
| 369 | |
| 370 | $this->end_controls_section(); // End Style Background |
| 371 | |
| 372 | } |
| 373 | |
| 374 | |
| 375 | /** |
| 376 | * Name: elementor_render() |
| 377 | * Desc: Render the widget output on the frontend. |
| 378 | * Params: no params |
| 379 | * Return: @void |
| 380 | * Since: @1.0.0 |
| 381 | * Package: @spider-elements |
| 382 | * Author: spider-themes |
| 383 | */ |
| 384 | protected function render() { |
| 385 | $settings = $this->get_settings_for_display(); |
| 386 | extract( $settings ); // extract all settings array to variables converted to name of key |
| 387 | |
| 388 | if ( $settings['style'] == 'unordered_list' ) { |
| 389 | ?> |
| 390 | <div class="steps-panel"> |
| 391 | <ul class="ordered-list"> |
| 392 | <?php |
| 393 | if ( ! empty( $ul_icon_list ) ) { |
| 394 | foreach ( $ul_icon_list as $item ) { |
| 395 | if ( ! empty( $item['text'] ) ) { ?> |
| 396 | <li class="elementor-repeater-item-<?php echo esc_attr( $item['_id'] ); ?>"> |
| 397 | <?php echo esc_html( $item['text'] ); ?> |
| 398 | </li> |
| 399 | <?php |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | ?> |
| 404 | </ul> |
| 405 | </div> |
| 406 | <?php |
| 407 | } elseif ( $settings['style'] == 'order_list' ) { |
| 408 | ?> |
| 409 | <div class="steps-panel"> |
| 410 | <ol class="ordered-list"> |
| 411 | <?php |
| 412 | if ( ! empty( $ul_icon_list ) ) { |
| 413 | foreach ( $ul_icon_list as $item ) { |
| 414 | if ( ! empty( $item['text'] ) ) { ?> |
| 415 | <li class="elementor-repeater-item-<?php echo esc_attr( $item['_id'] ); ?>"> |
| 416 | <?php echo esc_html( $item['text'] ) ?> |
| 417 | </li> |
| 418 | <?php |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | ?> |
| 423 | </ol> |
| 424 | </div> |
| 425 | <?php |
| 426 | } |
| 427 | } |
| 428 | } |
| 429 |