From 5d7d4b6b9f5d0f6270d492f0ac1dd3e74db2eb91 Mon Sep 17 00:00:00 2001 From: Devin Walker Date: Tue, 10 Dec 2024 08:48:51 -0800 Subject: [PATCH] Format donation count output in progress bar component (#7209) Co-authored-by: Jon Waldstein Co-authored-by: Kyle B. Johnson --- src/MultiFormGoals/ProgressBar/Model.php | 17 +++++++++++++++++ .../resources/views/progressbar.php | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/MultiFormGoals/ProgressBar/Model.php b/src/MultiFormGoals/ProgressBar/Model.php index ea024438e2..23beb43e8b 100644 --- a/src/MultiFormGoals/ProgressBar/Model.php +++ b/src/MultiFormGoals/ProgressBar/Model.php @@ -161,6 +161,23 @@ public function getDonationCount(): int return $results->count; } + /** + * Get formatted number of donations + * + * @unreleased + */ + public function getFormattedDonationCount(): string + { + return give_format_amount( + $this->getDonationCount(), + [ + 'sanitize' => false, + 'decimal' => false, + 'currency' => false, + ] + ); + } + /** * Get formatted total remaining (ex: $75) * diff --git a/src/MultiFormGoals/resources/views/progressbar.php b/src/MultiFormGoals/resources/views/progressbar.php index ac27e0ab47..b487d1815e 100644 --- a/src/MultiFormGoals/resources/views/progressbar.php +++ b/src/MultiFormGoals/resources/views/progressbar.php @@ -2,6 +2,9 @@ /** * Multi-Form Goals block/shortcode template * Styles for this template are defined in 'blocks/multi-form-goals/common.scss' + * + * @unreleased Format the donation count + * * @var Give\MultiFormGoals\ProgressBar\Model $this */ @@ -32,7 +35,7 @@
getDonationCount()); ?>
+ echo esc_html($this->getFormattedDonationCount()); ?>
getDonationCount(), 'give'); ?>