PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
← All changes | src/FormBuilder/ViewModels/FormBuilderViewModel.php +5 -1 4.16.74.17.0 View file →
@@ -2,9 +2,11 @@
2 2
3 3 namespace Give\FormBuilder\ViewModels;
4 4
5 5 use Give\Campaigns\Models\Campaign;
6 +use Give\DonationForms\Actions\GenerateDonationFormPageUrl;
6 7 use Give\DonationForms\Actions\GenerateDonationFormPreviewRouteUrl;
8 +use Give\DonationForms\Actions\GenerateExternalEmbedScriptUrl;
7 9 use Give\DonationForms\Models\DonationForm;
8 10 use Give\DonationForms\ValueObjects\GoalProgressType;
9 11 use Give\DonationForms\ValueObjects\GoalSource;
10 12 use Give\DonationForms\ValueObjects\GoalType;
@@ -24,8 +26,9 @@
24 26
25 27 class FormBuilderViewModel
26 28 {
27 29 /**
30 + * @since 4.17.0 Add externalEmbedScriptUrl key (naming the form, so the embed script carries its skeleton) to the returned array; build permalink through GenerateDonationFormPageUrl
28 31 * @since 4.14.0 Add countries key to the returned array
29 32 * @since 3.12.0 Add goalProgressOptions key to the returned array
30 33 * @since 3.9.0 Add support to intlTelInputSettings key in the returned array
31 34 * @since 3.7.0 Add support to isExcerptEnabled key in the returned array
@@ -40,8 +43,9 @@
40 43 return [
41 44 'formId' => $donationFormId,
42 45 'resourceURL' => rest_url(FormBuilderRestRouteConfig::NAMESPACE . '/form/' . $donationFormId),
43 46 'previewURL' => (new GenerateDonationFormPreviewRouteUrl())($donationFormId),
47 + 'externalEmbedScriptUrl' => (new GenerateExternalEmbedScriptUrl())($donationFormId),
44 48 'nonce' => wp_create_nonce('wp_rest'),
45 49 'blockData' => $donationForm->blocks->toJson(),
46 50 'settings' => $donationForm->settings->toJson(),
47 51 'currency' => give_get_currency(),
@@ -57,9 +61,9 @@
57 61 }, give(FormDesignRegistrar::class)->getDesigns()),
58 62 'formPage' => [
59 63 'isEnabled' => give_is_setting_enabled(give_get_option('forms_singular')),
60 64 // Note: Boolean values must be nested in an array to maintain boolean type, see \WP_Scripts::localize().
61 - 'permalink' => add_query_arg(['p' => $donationFormId], site_url('?post_type=give_forms')),
65 + 'permalink' => (new GenerateDonationFormPageUrl())($donationFormId),
62 66 'rewriteSlug' => get_post_type_object('give_forms')->rewrite['slug'],
63 67 'baseUrl' => preg_replace('/^https?:\/\//', '', site_url()),
64 68 ],
65 69 'gateways' => $this->getGateways(),