Conditions | 1 |
Paths | 1 |
Total Lines | 526 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
88 | function get_settings() { |
||
89 | $post_id = give_get_admin_post_id(); |
||
90 | $price_placeholder = give_format_decimal( '1.00', false, false ); |
||
91 | |||
92 | // Start with an underscore to hide fields from custom fields list |
||
93 | $prefix = '_give_'; |
||
94 | |||
95 | $settings = array( |
||
96 | /** |
||
97 | * Repeatable Field Groups |
||
98 | */ |
||
99 | 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
||
100 | 'id' => 'form_field_options', |
||
101 | 'title' => __( 'Donation Options', 'give' ), |
||
102 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
||
103 | 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
||
104 | // Donation Option. |
||
105 | array( |
||
106 | 'name' => __( 'Donation Option', 'give' ), |
||
107 | 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
||
108 | 'id' => $prefix . 'price_option', |
||
109 | 'type' => 'radio_inline', |
||
110 | 'default' => 'multi', |
||
111 | 'options' => apply_filters( 'give_forms_price_options', array( |
||
112 | 'multi' => __( 'Multi-level Donation', 'give' ), |
||
113 | 'set' => __( 'Set Donation', 'give' ), |
||
114 | ) ), |
||
115 | ), |
||
116 | array( |
||
117 | 'name' => __( 'Set Donation', 'give' ), |
||
118 | 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
||
119 | 'id' => $prefix . 'set_price', |
||
120 | 'type' => 'text_small', |
||
121 | 'data_type' => 'price', |
||
122 | 'attributes' => array( |
||
123 | 'placeholder' => $price_placeholder, |
||
124 | 'class' => 'give-money-field', |
||
125 | ), |
||
126 | ), |
||
127 | // Display Style. |
||
128 | array( |
||
129 | 'name' => __( 'Display Style', 'give' ), |
||
130 | 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
||
131 | 'id' => $prefix . 'display_style', |
||
132 | 'type' => 'radio_inline', |
||
133 | 'default' => 'buttons', |
||
134 | 'options' => array( |
||
135 | 'buttons' => __( 'Buttons', 'give' ), |
||
136 | 'radios' => __( 'Radios', 'give' ), |
||
137 | 'dropdown' => __( 'Dropdown', 'give' ), |
||
138 | ), |
||
139 | 'wrapper_class' => 'give-hidden', |
||
140 | ), |
||
141 | // Custom Amount. |
||
142 | array( |
||
143 | 'name' => __( 'Custom Amount', 'give' ), |
||
144 | 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
||
145 | 'id' => $prefix . 'custom_amount', |
||
146 | 'type' => 'radio_inline', |
||
147 | 'default' => 'disabled', |
||
148 | 'options' => array( |
||
149 | 'enabled' => __( 'Enabled', 'give' ), |
||
150 | 'disabled' => __( 'Disabled', 'give' ), |
||
151 | ), |
||
152 | ), |
||
153 | array( |
||
154 | 'name' => __( 'Donation Limit', 'give' ), |
||
155 | 'description' => __( 'Set the minimum and maximum amount for all gateways.', 'give' ), |
||
156 | 'id' => $prefix . 'custom_amount_range', |
||
157 | 'type' => 'donation_limit', |
||
158 | 'wrapper_class' => 'give-hidden', |
||
159 | 'data_type' => 'price', |
||
160 | 'attributes' => array( |
||
161 | 'placeholder' => $price_placeholder, |
||
162 | 'class' => 'give-money-field', |
||
163 | ), |
||
164 | 'options' => array( |
||
165 | 'display_label' => __( 'Donation Limits: ', 'give' ), |
||
166 | 'minimum' => give_format_decimal( '1.00', false, false ), |
||
167 | 'maximum' => give_format_decimal( '999999.99', false, false ), |
||
168 | ), |
||
169 | ), |
||
170 | array( |
||
171 | 'name' => __( 'Custom Amount Text', 'give' ), |
||
172 | 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
||
173 | 'id' => $prefix . 'custom_amount_text', |
||
174 | 'type' => 'text_medium', |
||
175 | 'attributes' => array( |
||
176 | 'rows' => 3, |
||
177 | 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
||
178 | ), |
||
179 | 'wrapper_class' => 'give-hidden', |
||
180 | ), |
||
181 | // Donation Levels. |
||
182 | array( |
||
183 | 'id' => $prefix . 'donation_levels', |
||
184 | 'type' => 'group', |
||
185 | 'options' => array( |
||
186 | 'add_button' => __( 'Add Level', 'give' ), |
||
187 | 'header_title' => __( 'Donation Level', 'give' ), |
||
188 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
||
189 | ), |
||
190 | 'wrapper_class' => 'give-hidden', |
||
191 | // Fields array works the same, except id's only need to be unique for this group. |
||
192 | // Prefix is not needed. |
||
193 | 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
||
194 | array( |
||
195 | 'name' => __( 'ID', 'give' ), |
||
196 | 'id' => $prefix . 'id', |
||
197 | 'type' => 'levels_id', |
||
198 | ), |
||
199 | array( |
||
200 | 'name' => __( 'Amount', 'give' ), |
||
201 | 'id' => $prefix . 'amount', |
||
202 | 'type' => 'text_small', |
||
203 | 'data_type' => 'price', |
||
204 | 'attributes' => array( |
||
205 | 'placeholder' => $price_placeholder, |
||
206 | 'class' => 'give-money-field', |
||
207 | ), |
||
208 | ), |
||
209 | array( |
||
210 | 'name' => __( 'Text', 'give' ), |
||
211 | 'id' => $prefix . 'text', |
||
212 | 'type' => 'text', |
||
213 | 'attributes' => array( |
||
214 | 'placeholder' => __( 'Donation Level', 'give' ), |
||
215 | 'class' => 'give-multilevel-text-field', |
||
216 | ), |
||
217 | ), |
||
218 | array( |
||
219 | 'name' => __( 'Default', 'give' ), |
||
220 | 'id' => $prefix . 'default', |
||
221 | 'type' => 'give_default_radio_inline', |
||
222 | ), |
||
223 | ) ), |
||
224 | ), |
||
225 | array( |
||
226 | 'name' => 'donation_options_docs', |
||
227 | 'type' => 'docs_link', |
||
228 | 'url' => 'http://docs.givewp.com/form-donation-options', |
||
229 | 'title' => __( 'Donation Options', 'give' ), |
||
230 | ), |
||
231 | ), |
||
232 | $post_id |
||
233 | ), |
||
234 | ) ), |
||
235 | |||
236 | /** |
||
237 | * Display Options |
||
238 | */ |
||
239 | 'form_display_options' => apply_filters( 'give_form_display_options', array( |
||
240 | 'id' => 'form_display_options', |
||
241 | 'title' => __( 'Form Display', 'give' ), |
||
242 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
||
243 | 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
||
244 | array( |
||
245 | 'name' => __( 'Display Options', 'give' ), |
||
246 | 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
||
247 | 'id' => $prefix . 'payment_display', |
||
248 | 'type' => 'radio_inline', |
||
249 | 'options' => array( |
||
250 | 'onpage' => __( 'All Fields', 'give' ), |
||
251 | 'modal' => __( 'Modal', 'give' ), |
||
252 | 'reveal' => __( 'Reveal', 'give' ), |
||
253 | 'button' => __( 'Button', 'give' ), |
||
254 | ), |
||
255 | 'default' => 'onpage', |
||
256 | ), |
||
257 | array( |
||
258 | 'id' => $prefix . 'reveal_label', |
||
259 | 'name' => __( 'Continue Button', 'give' ), |
||
260 | 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
||
261 | 'type' => 'text_small', |
||
262 | 'attributes' => array( |
||
263 | 'placeholder' => __( 'Donate Now', 'give' ), |
||
264 | ), |
||
265 | 'wrapper_class' => 'give-hidden', |
||
266 | ), |
||
267 | array( |
||
268 | 'id' => $prefix . 'checkout_label', |
||
269 | 'name' => __( 'Submit Button', 'give' ), |
||
270 | 'desc' => __( 'The button label for completing a donation.', 'give' ), |
||
271 | 'type' => 'text_small', |
||
272 | 'attributes' => array( |
||
273 | 'placeholder' => __( 'Donate Now', 'give' ), |
||
274 | ), |
||
275 | ), |
||
276 | array( |
||
277 | 'name' => __( 'Default Gateway', 'give' ), |
||
278 | 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
||
279 | 'id' => $prefix . 'default_gateway', |
||
280 | 'type' => 'default_gateway', |
||
281 | ), |
||
282 | array( |
||
283 | 'name' => __( 'Name Title Prefix', 'give' ), |
||
284 | 'desc' => __( 'Do you want to add a name title prefix dropdown field before the donor\'s first name field? This will display a dropdown with options such as Mrs, Miss, Ms, Sir, and Dr for donor to choose from.', 'give' ), |
||
285 | 'id' => $prefix . 'name_title_prefix', |
||
286 | 'type' => 'radio_inline', |
||
287 | 'options' => array( |
||
288 | 'global' => __( 'Global Option', 'give' ), |
||
289 | 'required' => __( 'Required', 'give' ), |
||
290 | 'optional' => __( 'Optional', 'give' ), |
||
291 | 'disabled' => __( 'Disabled', 'give' ), |
||
292 | ), |
||
293 | 'default' => 'global', |
||
294 | ), |
||
295 | array( |
||
296 | 'name' => __( 'Title Prefixes', 'give' ), |
||
297 | 'desc' => __( 'Add or remove salutations from the dropdown using the field above.', 'give' ), |
||
298 | 'id' => $prefix . 'title_prefixes', |
||
299 | 'type' => 'chosen', |
||
300 | 'data_type' => 'multiselect', |
||
301 | 'style' => 'width: 100%', |
||
302 | 'wrapper_class' => 'give-hidden give-title-prefixes-wrap', |
||
303 | 'options' => give_get_default_title_prefixes(), |
||
304 | ), |
||
305 | array( |
||
306 | 'name' => __( 'Company Donations', 'give' ), |
||
307 | 'desc' => __( 'Do you want a Company field to appear after First Name and Last Name?', 'give' ), |
||
308 | 'id' => $prefix . 'company_field', |
||
309 | 'type' => 'radio_inline', |
||
310 | 'default' => 'global', |
||
311 | 'options' => array( |
||
312 | 'global' => __( 'Global Option', 'give' ), |
||
313 | 'required' => __( 'Required', 'give' ), |
||
314 | 'optional' => __( 'Optional', 'give' ), |
||
315 | 'disabled' => __( 'Disabled', 'give' ), |
||
316 | |||
317 | ), |
||
318 | ), |
||
319 | array( |
||
320 | 'name' => __( 'Anonymous Donations', 'give' ), |
||
321 | 'desc' => __( 'Do you want to provide donors the ability mark themselves anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give' ), |
||
322 | 'id' => "{$prefix}anonymous_donation", |
||
323 | 'type' => 'radio_inline', |
||
324 | 'default' => 'global', |
||
325 | 'options' => array( |
||
326 | 'global' => __( 'Global Option', 'give' ), |
||
327 | 'enabled' => __( 'Enabled', 'give' ), |
||
328 | 'disabled' => __( 'Disabled', 'give' ), |
||
329 | ), |
||
330 | ), |
||
331 | array( |
||
332 | 'name' => __( 'Donor Comments', 'give' ), |
||
333 | 'desc' => __( 'Do you want to provide donors the ability to add a comment to their donation? The comment will display publicly on the donor wall if they do not select to give anonymously.', 'give' ), |
||
334 | 'id' => "{$prefix}donor_comment", |
||
335 | 'type' => 'radio_inline', |
||
336 | 'default' => 'global', |
||
337 | 'options' => array( |
||
338 | 'global' => __( 'Global Option', 'give' ), |
||
339 | 'enabled' => __( 'Enabled', 'give' ), |
||
340 | 'disabled' => __( 'Disabled', 'give' ), |
||
341 | ), |
||
342 | ), |
||
343 | array( |
||
344 | 'name' => __( 'Guest Donations', 'give' ), |
||
345 | 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
||
346 | 'id' => $prefix . 'logged_in_only', |
||
347 | 'type' => 'radio_inline', |
||
348 | 'default' => 'enabled', |
||
349 | 'options' => array( |
||
350 | 'enabled' => __( 'Enabled', 'give' ), |
||
351 | 'disabled' => __( 'Disabled', 'give' ), |
||
352 | ), |
||
353 | ), |
||
354 | array( |
||
355 | 'name' => __( 'Registration', 'give' ), |
||
356 | 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
||
357 | 'id' => $prefix . 'show_register_form', |
||
358 | 'type' => 'radio', |
||
359 | 'options' => array( |
||
360 | 'none' => __( 'None', 'give' ), |
||
361 | 'registration' => __( 'Registration', 'give' ), |
||
362 | 'login' => __( 'Login', 'give' ), |
||
363 | 'both' => __( 'Registration + Login', 'give' ), |
||
364 | ), |
||
365 | 'default' => 'none', |
||
366 | ), |
||
367 | array( |
||
368 | 'name' => __( 'Floating Labels', 'give' ), |
||
369 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
||
370 | 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
||
371 | 'id' => $prefix . 'form_floating_labels', |
||
372 | 'type' => 'radio_inline', |
||
373 | 'options' => array( |
||
374 | 'global' => __( 'Global Option', 'give' ), |
||
375 | 'enabled' => __( 'Enabled', 'give' ), |
||
376 | 'disabled' => __( 'Disabled', 'give' ), |
||
377 | ), |
||
378 | 'default' => 'global', |
||
379 | ), |
||
380 | array( |
||
381 | 'name' => 'form_display_docs', |
||
382 | 'type' => 'docs_link', |
||
383 | 'url' => 'http://docs.givewp.com/form-display-options', |
||
384 | 'title' => __( 'Form Display', 'give' ), |
||
385 | ), |
||
386 | ), |
||
387 | $post_id |
||
388 | ), |
||
389 | ) |
||
390 | ), |
||
391 | |||
392 | /** |
||
393 | * Donation Goals |
||
394 | */ |
||
395 | 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
||
396 | 'id' => 'donation_goal_options', |
||
397 | 'title' => __( 'Donation Goal', 'give' ), |
||
398 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
||
399 | 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
||
400 | // Goals |
||
401 | array( |
||
402 | 'name' => __( 'Donation Goal', 'give' ), |
||
403 | 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
||
404 | 'id' => $prefix . 'goal_option', |
||
405 | 'type' => 'radio_inline', |
||
406 | 'default' => 'disabled', |
||
407 | 'options' => array( |
||
408 | 'enabled' => __( 'Enabled', 'give' ), |
||
409 | 'disabled' => __( 'Disabled', 'give' ), |
||
410 | ), |
||
411 | ), |
||
412 | |||
413 | array( |
||
414 | 'name' => __( 'Goal Format', 'give' ), |
||
415 | 'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give' ), |
||
416 | 'id' => $prefix . 'goal_format', |
||
417 | 'type' => 'donation_form_goal', |
||
418 | 'default' => 'amount', |
||
419 | 'options' => array( |
||
420 | 'amount' => __( 'Amount Raised', 'give' ), |
||
421 | 'percentage' => __( 'Percentage Raised', 'give' ), |
||
422 | 'donation' => __( 'Number of Donations', 'give' ), |
||
423 | 'donors' => __( 'Number of Donors', 'give' ), |
||
424 | ), |
||
425 | ), |
||
426 | |||
427 | array( |
||
428 | 'name' => __( 'Goal Amount', 'give' ), |
||
429 | 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
||
430 | 'id' => $prefix . 'set_goal', |
||
431 | 'type' => 'text_small', |
||
432 | 'data_type' => 'price', |
||
433 | 'attributes' => array( |
||
434 | 'placeholder' => $price_placeholder, |
||
435 | 'class' => 'give-money-field', |
||
436 | ), |
||
437 | 'wrapper_class' => 'give-hidden', |
||
438 | ), |
||
439 | array( |
||
440 | 'id' => $prefix . 'number_of_donation_goal', |
||
441 | 'name' => __( 'Donation Goal', 'give' ), |
||
442 | 'desc' => __( 'Set the total number of donations as a goal.', 'give' ), |
||
443 | 'type' => 'number', |
||
444 | 'default' => 1, |
||
445 | 'attributes' => array( |
||
446 | 'placeholder' => 1, |
||
447 | ), |
||
448 | ), |
||
449 | array( |
||
450 | 'id' => $prefix . 'number_of_donor_goal', |
||
451 | 'name' => __( 'Donor Goal', 'give' ), |
||
452 | 'desc' => __( 'Set the total number of donors as a goal.', 'give' ), |
||
453 | 'type' => 'number', |
||
454 | 'default' => 1, |
||
455 | 'attributes' => array( |
||
456 | 'placeholder' => 1, |
||
457 | ), |
||
458 | ), |
||
459 | array( |
||
460 | 'name' => __( 'Progress Bar Color', 'give' ), |
||
461 | 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
||
462 | 'id' => $prefix . 'goal_color', |
||
463 | 'type' => 'colorpicker', |
||
464 | 'default' => '#2bc253', |
||
465 | 'wrapper_class' => 'give-hidden', |
||
466 | ), |
||
467 | |||
468 | array( |
||
469 | 'name' => __( 'Close Form', 'give' ), |
||
470 | 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
||
471 | 'id' => $prefix . 'close_form_when_goal_achieved', |
||
472 | 'type' => 'radio_inline', |
||
473 | 'default' => 'disabled', |
||
474 | 'options' => array( |
||
475 | 'enabled' => __( 'Enabled', 'give' ), |
||
476 | 'disabled' => __( 'Disabled', 'give' ), |
||
477 | ), |
||
478 | 'wrapper_class' => 'give-hidden', |
||
479 | ), |
||
480 | array( |
||
481 | 'name' => __( 'Goal Achieved Message', 'give' ), |
||
482 | 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
||
483 | 'id' => $prefix . 'form_goal_achieved_message', |
||
484 | 'type' => 'wysiwyg', |
||
485 | 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
||
486 | 'wrapper_class' => 'give-hidden', |
||
487 | ), |
||
488 | array( |
||
489 | 'name' => 'donation_goal_docs', |
||
490 | 'type' => 'docs_link', |
||
491 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
||
492 | 'title' => __( 'Donation Goal', 'give' ), |
||
493 | ), |
||
494 | ), |
||
495 | $post_id |
||
496 | ), |
||
497 | ) ), |
||
498 | |||
499 | /** |
||
500 | * Content Field |
||
501 | */ |
||
502 | 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
||
503 | 'id' => 'form_content_options', |
||
504 | 'title' => __( 'Form Content', 'give' ), |
||
505 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
||
506 | 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
||
507 | |||
508 | // Donation content. |
||
509 | array( |
||
510 | 'name' => __( 'Display Content', 'give' ), |
||
511 | 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
||
512 | 'id' => $prefix . 'display_content', |
||
513 | 'type' => 'radio_inline', |
||
514 | 'options' => array( |
||
515 | 'enabled' => __( 'Enabled', 'give' ), |
||
516 | 'disabled' => __( 'Disabled', 'give' ), |
||
517 | ), |
||
518 | 'default' => 'disabled', |
||
519 | ), |
||
520 | |||
521 | // Content placement. |
||
522 | array( |
||
523 | 'name' => __( 'Content Placement', 'give' ), |
||
524 | 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
||
525 | 'id' => $prefix . 'content_placement', |
||
526 | 'type' => 'radio_inline', |
||
527 | 'options' => apply_filters( 'give_forms_content_options_select', array( |
||
528 | 'give_pre_form' => __( 'Above fields', 'give' ), |
||
529 | 'give_post_form' => __( 'Below fields', 'give' ), |
||
530 | ) |
||
531 | ), |
||
532 | 'default' => 'give_pre_form', |
||
533 | 'wrapper_class' => 'give-hidden', |
||
534 | ), |
||
535 | array( |
||
536 | 'name' => __( 'Content', 'give' ), |
||
537 | 'description' => __( 'This content will display on the single give form page.', 'give' ), |
||
538 | 'id' => $prefix . 'form_content', |
||
539 | 'type' => 'wysiwyg', |
||
540 | 'wrapper_class' => 'give-hidden', |
||
541 | ), |
||
542 | array( |
||
543 | 'name' => 'form_content_docs', |
||
544 | 'type' => 'docs_link', |
||
545 | 'url' => 'http://docs.givewp.com/form-content', |
||
546 | 'title' => __( 'Form Content', 'give' ), |
||
547 | ), |
||
548 | ), |
||
549 | $post_id |
||
550 | ), |
||
551 | ) ), |
||
552 | |||
553 | /** |
||
554 | * Terms & Conditions |
||
555 | */ |
||
556 | 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
||
557 | 'id' => 'form_terms_options', |
||
558 | 'title' => __( 'Terms & Conditions', 'give' ), |
||
559 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
||
560 | 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
||
561 | // Donation Option |
||
562 | array( |
||
563 | 'name' => __( 'Terms and Conditions', 'give' ), |
||
564 | 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
||
565 | 'id' => $prefix . 'terms_option', |
||
566 | 'type' => 'radio_inline', |
||
567 | 'options' => apply_filters( 'give_forms_content_options_select', array( |
||
568 | 'global' => __( 'Global Option', 'give' ), |
||
569 | 'enabled' => __( 'Customize', 'give' ), |
||
570 | 'disabled' => __( 'Disable', 'give' ), |
||
571 | ) |
||
572 | ), |
||
573 | 'default' => 'global', |
||
574 | ), |
||
575 | array( |
||
576 | 'id' => $prefix . 'agree_label', |
||
577 | 'name' => __( 'Agreement Label', 'give' ), |
||
578 | 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
||
579 | 'type' => 'textarea', |
||
580 | 'attributes' => array( |
||
581 | 'placeholder' => __( 'Agree to Terms?', 'give' ), |
||
582 | 'rows' => 1 |
||
583 | ), |
||
584 | 'wrapper_class' => 'give-hidden', |
||
585 | ), |
||
586 | array( |
||
587 | 'id' => $prefix . 'agree_text', |
||
588 | 'name' => __( 'Agreement Text', 'give' ), |
||
589 | 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
||
590 | 'default' => give_get_option( 'agreement_text' ), |
||
591 | 'type' => 'wysiwyg', |
||
592 | 'wrapper_class' => 'give-hidden', |
||
593 | ), |
||
594 | array( |
||
595 | 'name' => 'terms_docs', |
||
596 | 'type' => 'docs_link', |
||
597 | 'url' => 'http://docs.givewp.com/form-terms', |
||
598 | 'title' => __( 'Terms and Conditions', 'give' ), |
||
599 | ), |
||
600 | ), |
||
601 | $post_id |
||
602 | ), |
||
603 | ) ), |
||
604 | ); |
||
605 | |||
606 | /** |
||
607 | * Filter the metabox tabbed panel settings. |
||
608 | */ |
||
609 | $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
||
610 | |||
611 | // Output. |
||
612 | return $settings; |
||
613 | } |
||
614 | |||
1331 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.