config.php
80 lines
| 1 | <?php |
| 2 | namespace ShopPress\Elementor\Widgets; |
| 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-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_single' ); |
| 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-description-wrapper', |
| 37 | 'wrapper' => '{{WRAPPER}}', |
| 38 | ), |
| 39 | ) |
| 40 | ); |
| 41 | |
| 42 | $this->register_group_styler( |
| 43 | 'description', |
| 44 | __( 'Description', 'shop-press' ), |
| 45 | array( |
| 46 | 'heading' => array( |
| 47 | 'label' => esc_html__( 'Description', 'shop-press' ), |
| 48 | 'type' => 'styler', |
| 49 | 'selector' => '.sp-description', |
| 50 | 'wrapper' => '{{WRAPPER}} .sp-description-wrapper', |
| 51 | ), |
| 52 | ) |
| 53 | ); |
| 54 | } |
| 55 | |
| 56 | protected function register_controls() { |
| 57 | $this->setup_styling_options(); |
| 58 | |
| 59 | do_action( 'shoppress/elementor/widget/register_controls_init', $this ); |
| 60 | } |
| 61 | |
| 62 | protected function render() { |
| 63 | do_action( 'shoppress/widget/before_render', $this->get_settings_for_display() ); |
| 64 | |
| 65 | if ( $this->editor_preview() ) { |
| 66 | sp_load_builder_template( 'single-product/product-description' ); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | protected function content_template() { |
| 71 | ?> |
| 72 | <div class="sp-description-wrapper"> |
| 73 | <p class="sp-description"> |
| 74 | This is a simple product. |
| 75 | </p> |
| 76 | </div> |
| 77 | <?php |
| 78 | } |
| 79 | } |
| 80 |