Actions
1 year ago
AdminFormListView
1 year ago
FormGrid
1 year ago
resources
1 year ago
AsyncDataHelpers.php
1 year ago
AsyncDataHelpers.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\DonationForms\AsyncData; |
| 4 | |
| 5 | use Give\DonationForms\DonationQuery; |
| 6 | use Give\MultiFormGoals\ProgressBar\Model as ProgressBarModel; |
| 7 | |
| 8 | /** |
| 9 | * @since 3.16.0 |
| 10 | */ |
| 11 | class AsyncDataHelpers |
| 12 | { |
| 13 | /** |
| 14 | * @since 3.16.0 |
| 15 | */ |
| 16 | public static function getFormDonationsCountValue($formId): int |
| 17 | { |
| 18 | return (new ProgressBarModel(['ids' => [$formId], 'statusList' => ['any']]))->getDonationCount(); |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * @since 3.16.0 |
| 23 | */ |
| 24 | public static function getFormRevenueValue($formId): int |
| 25 | { |
| 26 | return (new DonationQuery())->form($formId)->sumIntendedAmount(); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * @since 3.16.0 |
| 31 | */ |
| 32 | public static function getSkeletonPlaceholder($width = '100%', $height = '0.7rem'): string |
| 33 | { |
| 34 | return '<span class="give-skeleton js-give-async-data" style="width: ' . esc_attr($width) . '; height: ' . esc_attr($height) . ';"></span>'; |
| 35 | } |
| 36 | } |
| 37 |