Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/ecommerce terminology: Rename give_checkout_button_purchase function #1730

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/ajax-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function give_load_checkout_fields() {

wp_send_json( array(
'fields' => wp_json_encode( $fields ),
'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
'submit' => wp_json_encode( give_get_donation_form_submit_button( $form_id ) ),
) );
}

Expand Down
1 change: 1 addition & 0 deletions includes/deprecated/deprecated-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function give_deprecated_filters() {
'give_recount_donors_donation_statuses' => 'give_recount_customer_payment_statuses',
'give_donor_recount_should_process_donation' => 'give_customer_recount_should_process_payment',
'give_reset_items' => 'give_reset_store_items',
'give_donation_form_submit_button' => 'give_checkout_button_purchase',
);

return $give_deprecated_filters;
Expand Down
29 changes: 29 additions & 0 deletions includes/deprecated/deprecated-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,32 @@ function give_get_purchase_form_user( $valid_data = array() ) {
give_get_donation_form_user( $valid_data );

}

/**
* Give Checkout Button.
*
* Renders the button on the Checkout.
*
* @since 1.0
* @deprecated 1.8.8
*
* @param int $form_id The form ID.
*
* @return string
*/
function give_checkout_button_purchase( $form_id ) {
$backtrace = debug_backtrace();

_give_deprecated_function( __FUNCTION__, '1.8.8', null, $backtrace );

$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ravinderk why don't you just call the renamed function give_get_donation_form_submit_button() within here without repeating the code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DevinWalker Good catch. Thank you for handling this

$display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
ob_start(); ?>
<div class="give-submit-button-wrap give-clearfix">
<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase"
value="<?php echo $display_label; ?>"/>
<span class="give-loading-animation"></span>
</div>
<?php
return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
}
24 changes: 11 additions & 13 deletions includes/forms/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ function give_checkout_submit( $form_id ) {

give_checkout_hidden_fields( $form_id );

echo give_checkout_button_purchase( $form_id );
echo give_get_donation_form_submit_button( $form_id );

/**
* Fire after donation form submit.
Expand All @@ -1613,28 +1613,26 @@ function give_checkout_submit( $form_id ) {
add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );

/**
* Give Checkout Button.
* Give Donation form submit button.
*
* Renders the button on the Checkout.
*
* @since 1.0
* @since 1.8.8
*
* @param int $form_id The form ID.
*
* @return string
*/
function give_checkout_button_purchase( $form_id ) {
function give_get_donation_form_submit_button( $form_id ) {

$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
$display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
ob_start(); ?>
<div class="give-submit-button-wrap give-clearfix">
<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase"
value="<?php echo $display_label; ?>"/>
<span class="give-loading-animation"></span>
</div>
ob_start();
?>
<div class="give-submit-button-wrap give-clearfix">
<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/>
<span class="give-loading-animation"></span>
</div>
<?php
return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id );
}

/**
Expand Down