Skip to content

Commit

Permalink
default to previous versions selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Barny-Thorpe committed Mar 20, 2024
1 parent 4662da6 commit 8814a9d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion public/js/gf-giftaid-field-frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', () => {
* Updates the gift aid display, based on a chosen field changing.
*/
function initGiftAid() {
const totalSelector = totalFieldSelector() || '.gfield.gfield--input-type-total';
const totalSelector = totalFieldSelector() || '.ginput_amount';
window.gform.addAction('gform_input_change', (elem) => {
const total = getTotalAmount(elem, totalSelector);
if (! total || !total.donation || !total.giftAidTotal) {
Expand Down
6 changes: 5 additions & 1 deletion src/GfGiftAidField.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public static function add_donation_total_select_setting($position, $form_id): v
<?php esc_html_e('Donation Total Select', 'itineris-gf-giftaid-field'); ?>
</label>

<select name="donation_total" id="donation_total_select_value" onchange="SetFieldProperty('donationTotalSelect', this.value);">
<select
name="donation_total"
id="donation_total_select_value"
onchange="SetFieldProperty('donationTotalSelect', this.value);"
>
<?php foreach ($field_options as $field_id => $field_label) : ?>
<?php
if (empty($field_id) || empty($field_label)) {
Expand Down
4 changes: 2 additions & 2 deletions src/GiftAidField.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class GiftAidField extends GF_Field
{
//! If you change $type var below it will break all instances of this field on every website.
// ! If you change $type var below it will break all instances of this field on every website.
public string $type = 'gift_aid';

public function get_form_editor_field_title(): string
Expand Down Expand Up @@ -67,7 +67,7 @@ public function get_field_input($form, $value = '', $entry = null): string
{
$id = (int) $this->id;
$giftaidImage = plugins_url('public/img/giftaid.svg', __DIR__);
$totalFieldClass = $this->donationTotalSelect ?? 'query_parameter';
$totalFieldClass = $this->donationTotalSelect ?? '.ginput_amount';

ob_start();
?>
Expand Down

0 comments on commit 8814a9d

Please sign in to comment.