PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.1.9
LatePoint – Calendar Booking Plugin for Appointments and Events v5.1.9
5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / blocks / elementor / elementor_widget_book_form.php
latepoint / blocks / elementor Last commit date
elementor_widget_book_button.php 1 year ago elementor_widget_book_form.php 1 year ago elementor_widget_calendar.php 1 year ago elementor_widget_customer_dashboard.php 1 year ago elementor_widget_customer_login.php 1 year ago elementor_widget_list_of_resources.php 1 year ago
elementor_widget_book_form.php
299 lines
1 <?php
2
3 class Latepoint_Elementor_Widget_Book_Form extends \Elementor\Widget_Base {
4
5 protected $widget_data;
6 /**
7 * Widget base constructor
8 */
9 public function __construct( $data = [], $args = null ) {
10 $this->widget_data = $args;
11 parent::__construct( $data, $args );
12
13 wp_register_script(
14 'elementor_widget_book_form_script',
15 LATEPOINT_PLUGIN_URL . 'blocks/assets/javascripts/elementor-widget-book-form.js',
16 ['jquery'],
17 LATEPOINT_VERSION
18 );
19 }
20
21
22 /**
23 * Get widget name
24 */
25 public function get_name(): string {
26 return 'latepoint_book_form';
27 }
28
29 /**
30 * Get widget title
31 */
32 public function get_title(): string {
33 return esc_html__( 'Booking Form', 'latepoint' );
34 }
35
36 /**
37 * Get widget icon
38 */
39 public function get_icon(): string {
40 return 'eicon-form-horizontal';
41 }
42
43 /**
44 * Get widget categories
45 */
46 public function get_categories(): array {
47 return [ OsElementorHelper::$category ];
48 }
49
50 public function get_script_depends() {
51 if (\Elementor\Plugin::$instance->editor->is_edit_mode() || \Elementor\Plugin::$instance->preview->is_preview_mode()) {
52 return ['elementor_widget_book_form_script'];
53 }
54 return [];
55 }
56
57 /**
58 * Register widget controls
59 */
60 protected function register_controls(): void {
61
62 # Booking Form Settings Section
63 $this->start_controls_section(
64 'content_section_booking_form_settings',
65 [
66 'label' => esc_html__( 'Booking Form Settings', 'latepoint' ),
67 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
68 ]
69 );
70
71 $this->add_control(
72 'hide_summary',
73 [
74 'label' => esc_html__( 'Hide Summary Panel', 'latepoint' ),
75 'type' => \Elementor\Controls_Manager::SWITCHER,
76 'label_on' => esc_html__( 'Yes', 'latepoint' ),
77 'label_off' => esc_html__( 'No', 'latepoint' ),
78 'return_value' => 'yes',
79 'default' => 'no',
80 ]
81 );
82
83 $this->add_control(
84 'hide_side_panel',
85 [
86 'label' => esc_html__( 'Hide Side Panel', 'latepoint' ),
87 'type' => \Elementor\Controls_Manager::SWITCHER,
88 'label_on' => esc_html__( 'Yes', 'latepoint' ),
89 'label_off' => esc_html__( 'No', 'latepoint' ),
90 'return_value' => 'yes',
91 'default' => 'no',
92 ]
93 );
94 $this->end_controls_section();
95
96
97 # Step Settings Section
98 $this->start_controls_section(
99 'content_section_step_settings',
100 [
101 'label' => esc_html__( 'Step Settings', 'latepoint' ),
102 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
103 ]
104 );
105
106 $this->add_control(
107 'selected_agent',
108 [
109 'label' => esc_html__('Preselected Agent', 'latepoint'),
110 'type' => \Elementor\Controls_Manager::SELECT,
111 'default' => '',
112 'options' => $this->widget_data['selected_agents_options'],
113 ]
114 );
115
116 $this->add_control(
117 'selected_service',
118 [
119 'label' => esc_html__('Preselected Service', 'latepoint'),
120 'type' => \Elementor\Controls_Manager::SELECT,
121 'default' => '',
122 'options' => $this->widget_data['selected_services_options'],
123 ]
124 );
125 $this->add_control(
126 'selected_service_category',
127 [
128 'label' => esc_html__('Preselected Service Category', 'latepoint'),
129 'type' => \Elementor\Controls_Manager::SELECT,
130 'default' => '',
131 'options' => $this->widget_data['selected_service_categories_options'],
132 ]
133 );
134
135 $this->add_control(
136 'selected_location',
137 [
138 'label' => esc_html__('Preselected Location', 'latepoint'),
139 'type' => \Elementor\Controls_Manager::SELECT,
140 'default' => '',
141 'options' => $this->widget_data['selected_locations_options'],
142 ]
143 );
144
145 $this->add_control(
146 'selected_start_date',
147 [
148 'label' => esc_html__( 'Preselected Booking Start Date', 'latepoint' ),
149 'type' => \Elementor\Controls_Manager::DATE_TIME,
150 'picker_options' => ['enableTime' => false],
151 'label_block' => false
152 ]
153 );
154
155 $this->add_control(
156 'selected_start_time',
157 [
158 'label' => esc_html__( 'Preselected Booking Start Time', 'latepoint' ),
159 'type' => \Elementor\Controls_Manager::TEXT,
160 'input_type' => 'time',
161 'placeholder' => esc_html__( 'HH:MM', 'latepoint' ),
162 'description' => esc_html__( 'Choose a time (format HH:MM)', 'latepoint' ),
163 ]
164 );
165
166 $this->add_control(
167 'selected_duration',
168 [
169 'label' => esc_html__( 'Preselected Duration', 'latepoint' ),
170 'type' => \Elementor\Controls_Manager::NUMBER,
171 'min' => 0,
172 'step' => 1,
173 'default' => 0,
174 'description' => esc_html__( 'Minutes', 'latepoint' ),
175 ]
176 );
177
178 $this->add_control(
179 'selected_total_attendees',
180 [
181 'label' => esc_html__( 'Preselected Total Attendees', 'latepoint' ),
182 'type' => \Elementor\Controls_Manager::NUMBER,
183 'min' => 0,
184 'step' => 1,
185 'default' => "",
186 ]
187 );
188 $this->end_controls_section();
189
190
191 # Other Settings Section
192 $this->start_controls_section(
193 'content_section_other_settings',
194 [
195 'label' => esc_html__( 'Other Settings', 'latepoint' ),
196 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
197 ]
198 );
199
200 $this->add_control(
201 'source_id',
202 [
203 'label' => esc_html__( 'Source ID', 'latepoint' ),
204 'type' => \Elementor\Controls_Manager::NUMBER,
205 'min' => 0,
206 'step' => 1,
207 'default' => "",
208 ]
209 );
210
211 $this->add_control(
212 'calendar_start_date',
213 [
214 'label' => esc_html__( 'Calendar Start Date', 'latepoint' ),
215 'type' => \Elementor\Controls_Manager::DATE_TIME,
216 'picker_options' => ['enableTime' => false],
217 'label_block' => false
218 ]
219 );
220
221 $this->add_control(
222 'show_services',
223 [
224 'label' => esc_html__('Show Services', 'latepoint'),
225 'type' => \Elementor\Controls_Manager::SELECT2,
226 'default' => '',
227 'options' => $this->widget_data['services'],
228 'multiple' => true
229 ]
230 );
231
232 $this->add_control(
233 'show_service_categories',
234 [
235 'label' => esc_html__( 'Show Service Categories', 'latepoint' ),
236 'type' => \Elementor\Controls_Manager::SELECT2,
237 'default' => '',
238 'multiple' => true,
239 'options' => $this->widget_data['service_categories'],
240 ]
241 );
242
243 $this->add_control(
244 'show_agents',
245 [
246 'label' => esc_html__( 'Show Agents', 'latepoint' ),
247 'type' => \Elementor\Controls_Manager::SELECT2,
248 'default' => '',
249 'multiple' => true,
250 'options' => $this->widget_data['agents'],
251 ]
252 );
253
254 $this->add_control(
255 'show_locations',
256 [
257 'label' => esc_html__( 'Show Locations', 'latepoint' ),
258 'type' => \Elementor\Controls_Manager::SELECT2,
259 'default' => '',
260 'multiple' => true,
261 'options' => $this->widget_data['locations'],
262 ]
263 );
264
265
266 $this->end_controls_section();
267 }
268
269
270 /**
271 * Render widget output on the frontend
272 */
273 protected function render(): void {
274 $settings = $this->get_settings_for_display();
275
276 $allowed_params = [
277 'hide_summary',
278 'hide_side_panel',
279 'selected_agent',
280 'selected_service',
281 'selected_service_category',
282 'selected_location',
283 'selected_start_date',
284 'selected_start_time',
285 'selected_duration',
286 'selected_total_attendees',
287 'source_id',
288 'calendar_start_date',
289 'show_services',
290 'show_service_categories',
291 'show_agents',
292 'show_locations',
293 ];
294
295 $params = OsBlockHelper::attributes_to_data_params($settings, $allowed_params);
296 echo do_shortcode('[latepoint_book_form ' . $params . ']');
297 }
298
299 }