empty-cart-message.php
138 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Elementor; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | use ShopEngine\Widgets\Products; |
| 8 | |
| 9 | class ShopEngine_Empty_Cart_Message extends \ShopEngine\Base\Widget |
| 10 | { |
| 11 | |
| 12 | public function config() { |
| 13 | return new ShopEngine_Empty_Cart_Message_Config(); |
| 14 | } |
| 15 | |
| 16 | protected function register_controls() { |
| 17 | |
| 18 | $this->start_controls_section( |
| 19 | 'shopengine_section_empty_cart_message_style', |
| 20 | [ |
| 21 | 'label' => esc_html__('Style', 'shopengine'), |
| 22 | 'tab' => Controls_Manager::TAB_STYLE, |
| 23 | ] |
| 24 | ); |
| 25 | |
| 26 | $this->add_control( |
| 27 | 'shopengine_empty_cart_message_color', |
| 28 | [ |
| 29 | 'label' => esc_html__('Color', 'shopengine'), |
| 30 | 'type' => Controls_Manager::COLOR, |
| 31 | 'alpha' => false, |
| 32 | 'default' => '#3a3a3a', |
| 33 | 'selectors' => [ |
| 34 | '{{WRAPPER}} .shopengine-empty-cart-message .cart-empty, {{WRAPPER}} .shopengine-empty-cart-message .cart-empty::before' => 'color: {{VALUE}};', |
| 35 | ], |
| 36 | ] |
| 37 | ); |
| 38 | |
| 39 | $this->add_control( |
| 40 | 'shopengine_empty_cart_message_bg_color', |
| 41 | [ |
| 42 | 'label' => esc_html__('Background', 'shopengine'), |
| 43 | 'type' => Controls_Manager::COLOR, |
| 44 | 'alpha' => false, |
| 45 | 'default' => '#f5f5f5', |
| 46 | 'selectors' => [ |
| 47 | '{{WRAPPER}} .shopengine-empty-cart-message .cart-empty' => 'min-height:auto;border-radius:0; background: {{VALUE}};', |
| 48 | ], |
| 49 | ] |
| 50 | ); |
| 51 | |
| 52 | $this->add_group_control( |
| 53 | Group_Control_Typography::get_type(), |
| 54 | [ |
| 55 | 'name' => 'shopengine_empty_cart_message_typography', |
| 56 | 'label' => esc_html__('Typography', 'shopengine'), |
| 57 | 'selector' => '{{WRAPPER}} .shopengine-empty-cart-message .cart-empty', |
| 58 | 'exclude' => ['font_style', 'text_decoration'], |
| 59 | 'fields_options' => [ |
| 60 | 'typography' => [ |
| 61 | 'default' => 'custom', |
| 62 | ], |
| 63 | 'font_weight' => [ |
| 64 | 'default' => '500', |
| 65 | ], |
| 66 | 'font_size' => [ |
| 67 | 'size_units' => ['px'], |
| 68 | 'default' => [ |
| 69 | 'size' => '16', |
| 70 | 'unit' => 'px', |
| 71 | ], |
| 72 | ], |
| 73 | |
| 74 | 'line_height' => [ |
| 75 | 'size_units' => ['px'], |
| 76 | 'default' => [ |
| 77 | 'size' => '22', |
| 78 | 'unit' => 'px', |
| 79 | ], |
| 80 | ] |
| 81 | ], |
| 82 | ] |
| 83 | ); |
| 84 | |
| 85 | $this->add_responsive_control( |
| 86 | 'shopengine_title_alignment', |
| 87 | [ |
| 88 | 'label' => esc_html__('Alignment', 'shopengine'), |
| 89 | 'type' => Controls_Manager::CHOOSE, |
| 90 | 'options' => [ |
| 91 | 'left' => [ |
| 92 | 'description' => esc_html__('Left', 'shopengine'), |
| 93 | 'icon' => 'fa fa-align-left', |
| 94 | ], |
| 95 | 'center' => [ |
| 96 | 'description' => esc_html__('Center', 'shopengine'), |
| 97 | 'icon' => 'fa fa-align-center', |
| 98 | ], |
| 99 | 'right' => [ |
| 100 | 'description' => esc_html__('Right', 'shopengine'), |
| 101 | 'icon' => 'fa fa-align-right', |
| 102 | ], |
| 103 | ], |
| 104 | 'selectors' => [ |
| 105 | '{{WRAPPER}} .shopengine-empty-cart-message .cart-empty' => 'text-align: {{VALUE}} !important;', |
| 106 | ] |
| 107 | ] |
| 108 | ); |
| 109 | |
| 110 | $this->add_control( |
| 111 | 'shopengine_empty_cart_padding', |
| 112 | [ |
| 113 | 'label' => esc_html__('Padding (px)', 'shopengine'), |
| 114 | 'type' => Controls_Manager::DIMENSIONS, |
| 115 | 'size_units' => ['px'], |
| 116 | 'default' => [ |
| 117 | 'top' => '10', |
| 118 | 'right' => '20', |
| 119 | 'bottom' => '10', |
| 120 | 'left' => '20', |
| 121 | 'isLinked' => false, |
| 122 | ], |
| 123 | 'selectors' => [ |
| 124 | '{{WRAPPER}} .shopengine-empty-cart-message .cart-empty' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 125 | ], |
| 126 | ] |
| 127 | ); |
| 128 | |
| 129 | $this->end_controls_section(); |
| 130 | } |
| 131 | |
| 132 | protected function screen() { |
| 133 | $tpl = Products::instance()->get_widget_template($this->get_name()); |
| 134 | |
| 135 | include $tpl; |
| 136 | } |
| 137 | } |
| 138 |