PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 4.16.3
GiveWP – Donation Plugin and Fundraising Platform v4.16.3
4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / src / ThirdPartySupport / Elementor / Widgets / V1 / GiveMultiFormGoalWidget.php
give / src / ThirdPartySupport / Elementor / Widgets / V1 Last commit date
resources 10 months ago DonationHistoryWidget.php 10 months ago DonationReceiptWidget.php 10 months ago GiveDonorWallWidget.php 10 months ago GiveFormGridWidget.php 9 months ago GiveFormWidget.php 10 months ago GiveGoalWidget.php 10 months ago GiveLoginWidget.php 10 months ago GiveMultiFormGoalWidget.php 10 months ago GiveProfileEditorWidget.php 10 months ago GiveRegisterWidget.php 10 months ago GiveSubscriptionsWidget.php 10 months ago GiveTotalsWidget.php 10 months ago
GiveMultiFormGoalWidget.php
238 lines
1 <?php
2
3 namespace Give\ThirdPartySupport\Elementor\Widgets\V1;
4
5 use Give\MultiFormGoals\MultiFormGoal\Shortcode;
6 use Elementor\Widget_Base;
7
8 /**
9 * Elementor Give Multi Form Goal Widget.
10 *
11 * Elementor widget that inserts the GiveWP [give_multi_form_goal] shortcode to output a Give Multi Form Goal.
12 *
13 * @since 4.7.0 migrated from givewp-elementor-widgets
14 */
15
16 class GiveMultiFormGoalWidget extends Widget_Base
17 {
18 /**
19 * GiveMultiFormGoalWidget constructor.
20 *
21 * @param array $data
22 * @param null $args
23 */
24 /**
25 * Get widget name.
26 *
27 * Retrieve Give Multi Form Goal widget name.
28 *
29 * @access public
30 *
31 * @return string Widget name.
32 */
33 public function get_name()
34 {
35 return 'Give Multi Form Goal';
36 }
37
38 /**
39 * Get widget title.
40 *
41 * Retrieve Give Multi Form Goal widget title.
42 *
43 * @access public
44 *
45 * @return string Widget title.
46 */
47 public function get_title()
48 {
49 return __('Give Multi Form Goal (Legacy)', 'give');
50 }
51
52 /**
53 * Get widget icon.
54 *
55 * Retrieve Give Multi Form Goal widget icon.
56 *
57 * @access public
58 *
59 * @return string Widget icon.
60 */
61 public function get_icon()
62 {
63 return 'give-icon';
64 }
65
66 /**
67 * Get widget categories.
68 *
69 * Retrieve the list of categories the Give Multi Form Goal widget belongs to.
70 *
71 * @access public
72 *
73 * @return array Widget categories.
74 */
75 public function get_categories()
76 {
77 return ['givewp-category-legacy'];
78 }
79
80 /**
81 * Widget inner wrapper.
82 *
83 * Use optimized DOM structure, without the inner wrapper.
84 *
85 * @since 4.7.0 migrated from givewp-elementor-widgets
86 * @access public
87 */
88 public function has_widget_inner_wrapper(): bool
89 {
90 return false;
91 }
92
93 /**
94 * Goal Give Multi Form Goal widget controls.
95 *
96 * Adds different input fields to allow the user to change and customize the widget settings.
97 *
98 * @access protected
99 */
100 protected function register_controls()
101 {
102 $this->start_controls_section(
103 'give_multi_form_goal_settings',
104 [
105 'label' => esc_html__('Give Multi Form Goal Widget', 'give'),
106 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
107 ]
108 );
109
110 $this->add_control(
111 'ids',
112 [
113 'label' => esc_html__('Donation Form IDs', 'give'),
114 'type' => \Elementor\Controls_Manager::TEXT,
115 'description' => esc_html__('Choose the IDs of the forms you want to display in the multi-form goal. Display all the forms (default), a single form ID, or a comma-separated list of IDs', 'give'),
116 'default' => '',
117 ]
118 );
119
120 if (give_get_option('tags') === 'enabled') {
121 $this->add_control(
122 'tags',
123 [
124 'label' => esc_html__('Tags', 'give'),
125 'type' => \Elementor\Controls_Manager::TEXT,
126 'description' => esc_html__('If you have tags enabled in GiveWP, you can list the category IDs that you want displayed in this grid. A comma-separated list of form tag IDs will cause the grid to include only forms with those tags.',
127 'give'),
128 'default' => '',
129 ]
130 );
131 }
132
133 if (give_get_option('categories') === 'enabled') {
134 $this->add_control(
135 'categories',
136 [
137 'label' => esc_html__('Categories', 'give'),
138 'type' => \Elementor\Controls_Manager::TEXT,
139 'description' => esc_html__('If you have categories enabled in GiveWP, you can list the category IDs that you want displayed in this grid. A comma-separated list of form category IDs will cause the grid to include only forms from those categories', 'give'),
140 'default' => '',
141 ]
142 );
143 }
144
145 $this->add_control(
146 'goal',
147 [
148 'label' => esc_html__('Goal Amount', 'give'),
149 'type' => \Elementor\Controls_Manager::TEXT,
150 'description' => esc_html__('Choose the goal amount to be displayed in the multi-form goal card.', 'give'),
151 'default' => '1000',
152 ]
153 );
154
155 $this->add_control(
156 'enddate',
157 [
158 'label' => esc_html__('End Date', 'give'),
159 'type' => \Elementor\Controls_Manager::TEXT,
160 'description' => esc_html__('Define when the multi-form goal should come to an end.', 'give'),
161 'default' => '',
162 ]
163 );
164
165 $this->add_control(
166 'color',
167 [
168 'label' => esc_html__('Color', 'give'),
169 'type' => \Elementor\Controls_Manager::COLOR,
170 'description' => esc_html__('Choose the primary color of the multi-form goal card', 'give'),
171 'default' => '#28c77b',
172 ]
173 );
174
175 $this->add_control(
176 'heading',
177 [
178 'label' => esc_html__('Heading Title', 'give'),
179 'type' => \Elementor\Controls_Manager::TEXT,
180 'description' => esc_html__('Choose the heading to be displayed on the multi-form goal card.', 'give'),
181 'default' => 'Example Heading',
182 ]
183 );
184
185 $this->add_control(
186 'image',
187 [
188 'label' => esc_html__('Featured Image of the Card', 'give'),
189 'type' => \Elementor\Controls_Manager::MEDIA,
190 'description' => esc_html__('Choose the image URL of the multi-form goal card.', 'give'),
191 'default' => [
192 'url' => GIVE_PLUGIN_URL . 'assets/dist/images/onboarding-preview-form-image.min.jpg',
193 ]
194 ]
195 );
196
197 $this->add_control(
198 'summary',
199 [
200 'label' => esc_html__('Summary', 'give'),
201 'type' => \Elementor\Controls_Manager::TEXT,
202 'description' => esc_html__('Choose the summary text placed below the heading title.', 'give'),
203 'default' => 'This is a summary.',
204 ]
205 );
206
207 $this->end_controls_section();
208 }
209
210 /**
211 * Render the [give_multi_form_goal] output on the frontend.
212 *
213 * Written in PHP and used to generate the final HTML.
214 *
215 * @access protected
216 */
217 protected function render()
218 {
219 $settings = $this->get_settings_for_display();
220
221 $attributes = [
222 'ids' => isset($settings['ids']) ? esc_attr($settings['ids']) : '',
223 'tags' => isset($settings['tags']) ? esc_attr($settings['tags']) : '',
224 'categories' => isset($settings['categories']) ? esc_attr($settings['categories']) : '',
225 'goal' => isset($settings['goal']) ? (int) $settings['goal'] : 1000,
226 'color' => isset($settings['color']) ? esc_attr($settings['color']) : '#28c77b',
227 'enddate' => isset($settings['enddate']) ? esc_attr($settings['enddate']) : '',
228 'heading' => isset($settings['heading']) ? esc_html($settings['heading']) : '',
229 'image' => isset($settings['image']['url']) ? esc_url($settings['image']['url']) : GIVE_PLUGIN_URL . 'assets/dist/images/onboarding-preview-form-image.min.jpg',
230 'summary' => isset($settings['summary']) ? esc_html($settings['summary']) : 'This is a summary.',
231 ];
232
233 $shortcode = new Shortcode();
234
235 printf('<div class="givewp-elementor-widget give-multi-form-goal-wrap">%s</div>', $shortcode->renderCallback($attributes));
236 }
237 }
238