PluginProbe
Commerce7 for WordPress / trunk
Commerce7 for WordPress vtrunk
1.8.1 1.8.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.3.4 1.3.5 1.4.0 1.4.1 All 37 releases
wp-commerce7 / includes / elementor / elementor-legacy.php

elementor-legacy.php in Commerce7 for WordPress trunk, at includes/elementor/elementor-legacy.php

165 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Elementor Integration
4 *
5 * @package wp-commerce7
6 * @author Michael Bourne
7 * @license GPL3
8 * @link https://ursa6.com
9 * @since 1.0.0
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 return;
14 }
15
16
17 /**
18 * Legacy Widget class
19 */
20 class C7WP_Elementor extends \Elementor\Widget_Base {
21
22
23 /**
24 * Get widget name.
25 *
26 * Retrieve Commerce7 widget name.
27 *
28 * @since 1.0.0
29 * @access public
30 *
31 * @return string Widget name.
32 */
33 public function get_name() {
34 return 'commerce7';
35 }
36
37 /**
38 * Get widget title.
39 *
40 * Retrieve Commerce7 widget title.
41 *
42 * @since 1.0.0
43 * @access public
44 *
45 * @return string Widget title.
46 */
47 public function get_title() {
48 return __( 'Commerce7 (Deprecated)', 'wp-commerce7' );
49 }
50
51 /**
52 * Get widget icon.
53 *
54 * Retrieve Commerce7 widget icon.
55 *
56 * @since 1.0.0
57 * @access public
58 *
59 * @return string Widget icon.
60 */
61 public function get_icon() {
62 return 'c7icon-c7sm';
63 }
64
65 /**
66 * Get widget categories.
67 *
68 * Retrieve the list of categories the widget belongs to.
69 *
70 * @since 1.0.0
71 * @access public
72 *
73 * @return array Widget categories.
74 */
75 public function get_categories() {
76 return [ 'commerce7' ];
77 }
78
79 /**
80 * Hide deprecated legacy widget from the Elementor panel.
81 *
82 * @return bool
83 */
84 public function show_in_panel() {
85 return false;
86 }
87
88 /**
89 * Register widget controls.
90 *
91 * Adds different input fields to allow the user to change and customize the widget settings.
92 *
93 * @since 1.0.0
94 * @access protected
95 */
96 protected function register_controls() { // phpcs:ignore
97
98 $this->start_controls_section(
99 'content_section',
100 [
101 'label' => __( 'Content', 'wp-commerce7' ),
102 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
103 ]
104 );
105
106 $this->add_control(
107 'type',
108 [
109 'label' => __( 'Content Type', 'wp-commerce7' ),
110 'type' => \Elementor\Controls_Manager::SELECT,
111 'default' => 'default',
112 'options' => [
113 'default' => __( 'Default Content', 'wp-commerce7' ),
114 'personalization' => __( 'Personalization Block', 'wp-commerce7' ),
115 'buy' => __( 'Buy Now (SKU)', 'wp-commerce7' ),
116 'buyslug' => __( 'Buy Now (Slug)', 'wp-commerce7' ),
117 'subscribe' => __( 'Subscribe Form', 'wp-commerce7' ),
118 'collection' => __( 'Collection Grid', 'wp-commerce7' ),
119 'login' => __( 'Login/Logout Link', 'wp-commerce7' ),
120 'cart' => __( 'Cart Data Link', 'wp-commerce7' ),
121 'reservation' => __( 'Reservation Widget', 'wp-commerce7' ),
122 'form' => __( 'General Form', 'wp-commerce7' ),
123 'joinnow' => __( 'Join/Edit Club magic button', 'wp-commerce7' ),
124 'quickshop' => __( 'Quick Shop form', 'wp-commerce7' ),
125 'loginform' => __( 'Login Form', 'wp-commerce7' ),
126 'createaccount' => __( 'Create account form', 'wp-commerce7' ),
127 ],
128 ]
129 );
130
131 $this->add_control(
132 'data',
133 [
134 'label' => __( 'Data/Slug', 'wp-commerce7' ),
135 'type' => \Elementor\Controls_Manager::TEXT,
136 ]
137 );
138
139 $this->end_controls_section();
140
141 }
142
143 /**
144 * Render Commerce widget output on the frontend.
145 *
146 * Written in PHP and used to generate the final HTML.
147 *
148 * @since 1.0.0
149 * @access protected
150 */
151 protected function render() {
152
153 $settings = $this->get_settings_for_display();
154
155 $type = esc_attr( $settings['type'] );
156 $data = esc_attr( $settings['data'] );
157
158 echo do_shortcode( '[c7wp type="' . $type . '" data="' . $data . '"]' );
159
160 }
161
162 protected function content_template() {}
163 public function render_plain_content( $instance = [] ) {}
164
165 }