archive-description.php
105 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Elementor; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | use ShopEngine\Widgets\Products; |
| 8 | |
| 9 | class ShopEngine_Archive_Description extends \ShopEngine\Base\Widget |
| 10 | { |
| 11 | |
| 12 | public function config() { |
| 13 | return new ShopEngine_Archive_Description_Config(); |
| 14 | } |
| 15 | |
| 16 | protected function register_controls() { |
| 17 | |
| 18 | $this->start_controls_section( |
| 19 | 'shopengine_section_archive_description_style', |
| 20 | array( |
| 21 | 'label' => esc_html__('Description', 'shopengine'), |
| 22 | 'tab' => Controls_Manager::TAB_STYLE, |
| 23 | ) |
| 24 | ); |
| 25 | |
| 26 | $this->add_responsive_control( |
| 27 | 'shopengine_archive_description_align', |
| 28 | \ShopEngine\Utils\Controls_Helper::get_alignment_conf( |
| 29 | 'elementor%s-align-', '', |
| 30 | [ |
| 31 | '{{WRAPPER}} .shopengine-product-description' => 'text-align: {{VALUE}}', |
| 32 | '.rtl {{WRAPPER}}.elementor-align-left .shopengine-archive-description' => 'text-align:right;', |
| 33 | '.rtl {{WRAPPER}}.elementor-align-right .shopengine-archive-description' => 'text-align:left;', |
| 34 | ], |
| 35 | ) |
| 36 | ); |
| 37 | |
| 38 | $this->add_control( |
| 39 | 'shopengine_archive_description_color', |
| 40 | [ |
| 41 | 'label' => esc_html__('Color', 'shopengine'), |
| 42 | 'type' => Controls_Manager::COLOR, |
| 43 | 'default' => '#101010', |
| 44 | 'alpha' => false, |
| 45 | 'selectors' => [ |
| 46 | '{{WRAPPER}} .shopengine-archive-description p' => 'color: {{VALUE}}; margin: 0;', |
| 47 | ], |
| 48 | ] |
| 49 | ); |
| 50 | |
| 51 | $this->add_group_control( |
| 52 | Group_Control_Typography::get_type(), |
| 53 | array( |
| 54 | 'name' => 'shopengine_archive_description_typography', |
| 55 | 'label' => esc_html__('Typography', 'shopengine'), |
| 56 | 'selector' => '{{WRAPPER}} .shopengine-archive-description p', |
| 57 | 'exclude' => ['letter_spacing', 'text_style', 'text_decoration'], |
| 58 | 'fields_options' => [ |
| 59 | 'typography' => [ |
| 60 | 'default' => 'custom', |
| 61 | ], |
| 62 | 'font_weight' => [ |
| 63 | 'default' => '400', |
| 64 | ], |
| 65 | 'font_size' => [ |
| 66 | 'default' => [ |
| 67 | 'size' => '16', |
| 68 | 'unit' => 'px' |
| 69 | ], |
| 70 | 'size_units' => ['px'] |
| 71 | |
| 72 | ], |
| 73 | 'text_transform' => [ |
| 74 | 'default' => '', |
| 75 | ], |
| 76 | 'line_height' => [ |
| 77 | 'default' => [ |
| 78 | 'size' => '20', |
| 79 | 'unit' => 'px' |
| 80 | ] |
| 81 | ], |
| 82 | 'letter_spacing' => [ |
| 83 | 'default' => [ |
| 84 | 'size' => '', |
| 85 | ] |
| 86 | ], |
| 87 | ], |
| 88 | ) |
| 89 | ); |
| 90 | |
| 91 | $this->end_controls_section(); |
| 92 | } |
| 93 | |
| 94 | protected function screen() { |
| 95 | |
| 96 | $post_type = get_post_type(); |
| 97 | |
| 98 | $product = Products::instance()->get_product($post_type); |
| 99 | |
| 100 | $tpl = Products::instance()->get_widget_template($this->get_name()); |
| 101 | |
| 102 | include $tpl; |
| 103 | } |
| 104 | } |
| 105 |