product-description.php
115 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | use ShopEngine\Widgets\Products; |
| 5 | |
| 6 | defined('ABSPATH') || exit; |
| 7 | |
| 8 | class ShopEngine_Product_Description extends \ShopEngine\Base\Widget |
| 9 | { |
| 10 | |
| 11 | public function config() { |
| 12 | return new ShopEngine_Product_Description_Config(); |
| 13 | } |
| 14 | |
| 15 | |
| 16 | protected function register_controls() { |
| 17 | /* |
| 18 | * Content Tab - Product description |
| 19 | */ |
| 20 | $this->start_controls_section( |
| 21 | 'shopengine_section_description', |
| 22 | [ |
| 23 | 'label' => esc_html__('Styles', 'shopengine'), |
| 24 | 'tab' => Controls_Manager::TAB_STYLE, |
| 25 | ] |
| 26 | ); |
| 27 | |
| 28 | $this->add_control( |
| 29 | 'shopengine_desc_color', |
| 30 | [ |
| 31 | 'label' => esc_html__('Color', 'shopengine'), |
| 32 | 'type' => Controls_Manager::COLOR, |
| 33 | 'default' => '#444444', |
| 34 | 'alpha' => false, |
| 35 | 'selectors' => [ |
| 36 | '{{WRAPPER}} .shopengine-product-description' => 'color: {{VALUE}};', |
| 37 | ], |
| 38 | ] |
| 39 | ); |
| 40 | |
| 41 | $this->add_group_control( |
| 42 | Group_Control_Typography::get_type(), |
| 43 | array( |
| 44 | 'name' => 'shopengine_desc_typography', |
| 45 | 'label' => esc_html__('Typography', 'shopengine'), |
| 46 | 'selector' => '{{WRAPPER}} .shopengine-product-description, {{WRAPPER}} .shopengine-product-description li', |
| 47 | 'exclude' => ['text_decoration'], |
| 48 | 'fields_options' => [ |
| 49 | 'typography' => [ |
| 50 | 'default' => 'custom', |
| 51 | ], |
| 52 | 'font_weight' => [ |
| 53 | 'default' => '400', |
| 54 | ], |
| 55 | 'font_size' => [ |
| 56 | 'default' => [ |
| 57 | 'size' => '17', |
| 58 | 'unit' => 'px' |
| 59 | ], |
| 60 | 'label' => 'Font size (px)', |
| 61 | 'size_units' => ['px'] |
| 62 | ], |
| 63 | 'line_height' => [ |
| 64 | 'default' => [ |
| 65 | 'size' => '22', |
| 66 | 'unit' => 'px' |
| 67 | ], |
| 68 | 'size_units' => ['px'] |
| 69 | ] |
| 70 | ], |
| 71 | ) |
| 72 | ); |
| 73 | |
| 74 | $this->add_responsive_control( |
| 75 | 'shopengine_desc_align', |
| 76 | [ |
| 77 | 'label' => esc_html__('Align', 'shopengine'), |
| 78 | 'type' => Controls_Manager::CHOOSE, |
| 79 | 'options' => [ |
| 80 | 'left' => [ |
| 81 | 'title' => esc_html__('Left', 'shopengine'), |
| 82 | 'icon' => 'eicon-text-align-left', |
| 83 | ], |
| 84 | 'center' => [ |
| 85 | 'title' => esc_html__('Center', 'shopengine'), |
| 86 | 'icon' => 'eicon-text-align-center', |
| 87 | ], |
| 88 | 'right' => [ |
| 89 | 'title' => esc_html__('Right', 'shopengine'), |
| 90 | 'icon' => 'eicon-text-align-right', |
| 91 | ], |
| 92 | ], |
| 93 | 'selectors' => [ |
| 94 | '{{WRAPPER}} .shopengine-product-description' => 'text-align: {{VALUE}}', |
| 95 | '.rtl {{WRAPPER}}.elementor-align-left .shopengine-product-description' => 'text-align:right;', |
| 96 | '.rtl {{WRAPPER}}.elementor-align-right .shopengine-product-description' => 'text-align:left;', |
| 97 | ], |
| 98 | 'prefix_class' => 'elementor%s-align-', |
| 99 | ] |
| 100 | ); |
| 101 | |
| 102 | |
| 103 | $this->end_controls_section(); |
| 104 | } |
| 105 | |
| 106 | |
| 107 | protected function screen() { |
| 108 | |
| 109 | $tpl = Products::instance()->get_widget_template($this->get_name()); |
| 110 | |
| 111 | include $tpl; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 |