| 1 |
<?php |
| 2 |
/** |
| 3 |
* The template used to display the default form. |
| 4 |
* |
| 5 |
* Override this template by copying it to yourtheme/charitable/donation-form/form-donation.php |
| 6 |
* |
| 7 |
* @author WP Charitable LLC |
| 8 |
* @package Charitable/Templates/Donation Form |
| 9 |
* @since 1.0.0 |
| 10 |
* @version 1.6.57 |
| 11 |
*/ |
| 12 |
|
| 13 |
// Exit if accessed directly. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
$form = $view_args['form']; |
| 19 |
$user = wp_get_current_user(); |
| 20 |
$use_ajax = 'make_donation' == $form->get_form_action() && (int) Charitable_Gateways::get_instance()->gateways_support_ajax(); |
| 21 |
$form_id = isset( $view_args['form_id'] ) ? $view_args['form_id'] : charitable_get_donation_form_id(); |
| 22 |
|
| 23 |
if ( ! $form ) { |
| 24 |
return; |
| 25 |
} |
| 26 |
?> |
| 27 |
<form method="post" id="<?php echo esc_attr( $form_id ); ?>" class="charitable-donation-form charitable-form" data-use-ajax="<?php echo esc_attr( $use_ajax ); ?>"> |
| 28 |
<?php |
| 29 |
/** |
| 30 |
* Do something before rendering the form fields. |
| 31 |
* |
| 32 |
* @since 1.0.0 |
| 33 |
* @since 1.6.0 Added $view_args parameter. |
| 34 |
* |
| 35 |
* @param Charitable_Form $form The form object. |
| 36 |
* @param array $view_args All args passed to template. |
| 37 |
*/ |
| 38 |
do_action( 'charitable_form_before_fields', $form, $view_args ); |
| 39 |
|
| 40 |
?> |
| 41 |
<div class="charitable-form-fields cf"> |
| 42 |
<?php $form->view()->render(); ?> |
| 43 |
</div><!-- .charitable-form-fields --> |
| 44 |
<?php |
| 45 |
/** |
| 46 |
* Do something after rendering the form fields. |
| 47 |
* |
| 48 |
* @since 1.0.0 |
| 49 |
* @since 1.6.0 Added $view_args parameter. |
| 50 |
* |
| 51 |
* @param Charitable_Form $form The form object. |
| 52 |
* @param array $view_args All args passed to template. |
| 53 |
*/ |
| 54 |
do_action( 'charitable_form_after_fields', $form, $view_args ); |
| 55 |
|
| 56 |
?> |
| 57 |
<div class="charitable-form-field charitable-submit-field"> |
| 58 |
<button class="<?php echo esc_attr( charitable_get_button_class( 'donate' ) ); ?>" type="submit" name="donate"><?php _e( 'Donate', 'charitable' ); ?></button> |
| 59 |
<div class="charitable-form-processing" style="display: none;"> |
| 60 |
<img src="<?php echo esc_url( charitable()->get_path( 'assets', false ) ); ?>images/charitable-loading.gif" width="60" height="60" alt="<?php esc_attr_e( 'Loading…', 'charitable' ); ?>" /> |
| 61 |
</div> |
| 62 |
</div> |
| 63 |
</form><!-- #<?php echo $form_id; ?>--> |
| 64 |
|