config.php
137 lines
| 1 | <?php |
| 2 | namespace ShopPress\Elementor\Widgets\LoopBuilder; |
| 3 | |
| 4 | use ShopPress\Elementor\ShopPressWidgets; |
| 5 | use Elementor\Controls_Manager; |
| 6 | |
| 7 | defined( 'ABSPATH' ) || exit; |
| 8 | |
| 9 | class Description extends ShopPressWidgets { |
| 10 | |
| 11 | public function get_name() { |
| 12 | return 'sp-item-description'; |
| 13 | } |
| 14 | |
| 15 | public function get_title() { |
| 16 | return __( 'Product Short Description', 'shop-press' ); |
| 17 | } |
| 18 | |
| 19 | public function get_icon() { |
| 20 | return 'sp-widget sp-eicon-product-description'; |
| 21 | } |
| 22 | |
| 23 | public function get_categories() { |
| 24 | return array( 'sp_woo_loop' ); |
| 25 | } |
| 26 | |
| 27 | public function setup_styling_options() { |
| 28 | |
| 29 | $this->register_group_styler( |
| 30 | 'wrapper', |
| 31 | __( 'Wrapper', 'shop-press' ), |
| 32 | array( |
| 33 | 'wrapper' => array( |
| 34 | 'label' => esc_html__( 'Wrapper', 'shop-press' ), |
| 35 | 'type' => 'styler', |
| 36 | 'selector' => '.sp-product-description', |
| 37 | ), |
| 38 | ) |
| 39 | ); |
| 40 | |
| 41 | $this->register_group_styler( |
| 42 | 'content', |
| 43 | __( 'Content', 'shop-press' ), |
| 44 | array( |
| 45 | 'div' => array( |
| 46 | 'label' => esc_html__( 'Div', 'shop-press' ), |
| 47 | 'type' => 'styler', |
| 48 | 'selector' => 'div', |
| 49 | 'wrapper' => '{{WRAPPER}} .sp-product-description', |
| 50 | ), |
| 51 | 'paragraph' => array( |
| 52 | 'label' => esc_html__( 'Paragraph', 'shop-press' ), |
| 53 | 'type' => 'styler', |
| 54 | 'selector' => 'p', |
| 55 | 'wrapper' => '{{WRAPPER}} .sp-product-description', |
| 56 | ), |
| 57 | 'heading_1' => array( |
| 58 | 'label' => esc_html__( 'Heading 1', 'shop-press' ), |
| 59 | 'type' => 'styler', |
| 60 | 'selector' => 'h1', |
| 61 | 'wrapper' => '{{WRAPPER}} .sp-product-description', |
| 62 | ), |
| 63 | 'heading_2' => array( |
| 64 | 'label' => esc_html__( 'Heading 2', 'shop-press' ), |
| 65 | 'type' => 'styler', |
| 66 | 'selector' => 'h2', |
| 67 | 'wrapper' => '{{WRAPPER}} .sp-product-description', |
| 68 | ), |
| 69 | 'heading_3' => array( |
| 70 | 'label' => esc_html__( 'Heading 3', 'shop-press' ), |
| 71 | 'type' => 'styler', |
| 72 | 'selector' => 'h3', |
| 73 | 'wrapper' => '{{WRAPPER}} .sp-product-description', |
| 74 | ), |
| 75 | 'heading_4' => array( |
| 76 | 'label' => esc_html__( 'Heading 4', 'shop-press' ), |
| 77 | 'type' => 'styler', |
| 78 | 'selector' => 'h4', |
| 79 | 'wrapper' => '{{WRAPPER}} .sp-product-description', |
| 80 | ), |
| 81 | 'heading_5' => array( |
| 82 | 'label' => esc_html__( 'Heading 5', 'shop-press' ), |
| 83 | 'type' => 'styler', |
| 84 | 'selector' => 'h5', |
| 85 | 'wrapper' => '{{WRAPPER}} .sp-product-description', |
| 86 | ), |
| 87 | 'heading_6' => array( |
| 88 | 'label' => esc_html__( 'Heading 6', 'shop-press' ), |
| 89 | 'type' => 'styler', |
| 90 | 'selector' => 'h6', |
| 91 | 'wrapper' => '{{WRAPPER}} .sp-product-description', |
| 92 | ), |
| 93 | 'span' => array( |
| 94 | 'label' => esc_html__( 'Span', 'shop-press' ), |
| 95 | 'type' => 'styler', |
| 96 | 'selector' => 'span', |
| 97 | 'wrapper' => '{{WRAPPER}} .sp-product-description', |
| 98 | ), |
| 99 | 'strong' => array( |
| 100 | 'label' => esc_html__( 'Strong', 'shop-press' ), |
| 101 | 'type' => 'styler', |
| 102 | 'selector' => 'strong', |
| 103 | 'wrapper' => '{{WRAPPER}} .sp-product-description', |
| 104 | ), |
| 105 | 'link' => array( |
| 106 | 'label' => esc_html__( 'Link', 'shop-press' ), |
| 107 | 'type' => 'styler', |
| 108 | 'selector' => 'a', |
| 109 | 'wrapper' => '{{WRAPPER}} .sp-product-description', |
| 110 | ), |
| 111 | ) |
| 112 | ); |
| 113 | } |
| 114 | |
| 115 | protected function register_controls() { |
| 116 | $this->setup_styling_options(); |
| 117 | |
| 118 | do_action( 'shoppress/elementor/widget/register_controls_init', $this ); |
| 119 | } |
| 120 | |
| 121 | protected function render() { |
| 122 | do_action( 'shoppress/widget/before_render', $this->get_settings_for_display() ); |
| 123 | |
| 124 | if ( $this->editor_preview() ) { |
| 125 | sp_load_builder_template( 'loop/loop-description' ); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | protected function content_template() { |
| 130 | ?> |
| 131 | <div class="sp-product-description"> |
| 132 | <p>This is a simple product.</p> |
| 133 | </div> |
| 134 | <?php |
| 135 | } |
| 136 | } |
| 137 |