PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.8
Booking for Appointments and Events Calendar – Amelia v2.4.8
2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Infrastructure / WP / Elementor / ElementorSharedShortcodeWidget.php
ameliabooking / src / Infrastructure / WP / Elementor Last commit date
AmeliaBookingElementorWidget.php 1 week ago AmeliaCatalogBookingElementorWidget.php 1 week ago AmeliaCatalogElementorWidget.php 1 week ago AmeliaElementorWhiteLabelHelper.php 1 week ago AmeliaEventsCalendarBookingElementorWidget.php 1 week ago AmeliaEventsElementorWidget.php 1 week ago AmeliaEventsListBookingButtonElementorWidget.php 1 week ago AmeliaEventsListBookingElementorWidget.php 1 week ago AmeliaStepBookingButtonElementorWidget.php 1 week ago AmeliaStepBookingElementorWidget.php 1 week ago ElementorBlock.php 1 week ago ElementorSharedShortcodeWidget.php 2 months ago
ElementorSharedShortcodeWidget.php
107 lines
1 <?php
2
3 /**
4 * @copyright © Melograno Ventures. All rights reserved.
5 * @licence See LICENCE.md for license details.
6 */
7
8 namespace Elementor;
9
10 use AmeliaBooking\Infrastructure\WP\Translations\BackendStrings;
11
12 /**
13 * Class ElementorSharedShortcodeWidget
14 *
15 * @package AmeliaBooking\Infrastructure\WP\Elementor
16 */
17 abstract class ElementorSharedShortcodeWidget extends Widget_Base
18 {
19 protected function setSharedShortcodeElements($controls_data)
20 {
21 $this->add_control(
22 'load_manually',
23 [
24 'label' => BackendStrings::get('manually_loading'),
25 'label_block' => true,
26 'type' => Controls_Manager::TEXT,
27 'placeholder' => '',
28 'description' => BackendStrings::get('manually_loading_description'),
29 ]
30 );
31
32 $this->add_control(
33 'trigger_type',
34 [
35 'label' => BackendStrings::get('trigger_type'),
36 'type' => Controls_Manager::SELECT,
37 'description' => BackendStrings::get('trigger_type_tooltip'),
38 'options' => [
39 'id' => BackendStrings::get('trigger_type_id'),
40 'class' => BackendStrings::get('trigger_type_class')
41 ],
42 'condition' => [
43 'load_manually!' => '',
44 ],
45 'default' => 'id'
46 ]
47 );
48
49 $this->add_control(
50 'in_dialog',
51 [
52 'label' => BackendStrings::get('in_dialog'),
53 'type' => Controls_Manager::SWITCHER,
54 'default' => false,
55 'label_on' => BackendStrings::get('yes'),
56 'label_off' => BackendStrings::get('no'),
57 'condition' => [
58 'load_manually!' => '',
59 ],
60 ]
61 );
62
63 if (!empty($controls_data['ivy'])) {
64 $this->add_control(
65 'ivy',
66 [
67 'label' => BackendStrings::get('ivy'),
68 'type' => Controls_Manager::SELECT,
69 'description' => BackendStrings::get('ivy_tooltip'),
70 'options' => $controls_data['ivy'],
71 'default' => '',
72 'condition' => [
73 'load_manually' => '',
74 ],
75 ]
76 );
77 }
78 }
79
80 protected function getSharedShortcodeString($settings)
81 {
82 $shortCode = '';
83
84 $trigger = $settings['load_manually'] !== '' ? ' trigger="' . esc_attr($settings['load_manually']) . '"' : '';
85 $trigger_type = $settings['load_manually'] && $settings['trigger_type'] !== '' ? ' trigger_type="' . esc_attr($settings['trigger_type']) . '"' : '';
86 $in_dialog = $settings['load_manually'] && $settings['in_dialog'] === 'yes' ? ' in_dialog=1' : '';
87 $ivy = !$settings['load_manually'] && !empty($settings['ivy']) && $settings['ivy'] !== '0' ? ' ivy="' . esc_attr($settings['ivy']) . '"' : '';
88
89 $shortCode .= $trigger . $trigger_type . $in_dialog . $ivy;
90
91 return $shortCode;
92 }
93
94 public static function setSharedShortcodeData($data, &$elementorData)
95 {
96 $elementorData['ivy'] = [];
97
98 if (empty($data['ivy'])) {
99 return;
100 }
101
102 foreach ($data['ivy'] as $form) {
103 $elementorData['ivy'][$form['value']] = $form['label'];
104 }
105 }
106 }
107