PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
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 2.30.0 All 255 releases
give / src / DonationForms / Factories / DonationFormFactory.php

DonationFormFactory.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/DonationForms/Factories/DonationFormFactory.php

49 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\DonationForms\Factories;
4
5 use Give\DonationForms\Properties\FormSettings;
6 use Give\DonationForms\ValueObjects\DonationFormStatus;
7 use Give\DonationForms\ValueObjects\GoalSource;
8 use Give\DonationForms\ValueObjects\GoalType;
9 use Give\Framework\Blocks\BlockCollection;
10 use Give\Framework\Models\Factories\ModelFactory;
11
12 class DonationFormFactory extends ModelFactory
13 {
14 /**
15 * @since 4.1.0 added goalSource
16 * @since 3.0.0
17 */
18 public function definition(): array
19 {
20 $blocksJson = file_get_contents(
21 GIVE_PLUGIN_DIR . 'src/FormBuilder/resources/js/form-builder/src/blocks.json'
22 );
23
24 return [
25 'title' => __('GiveWP Donation Form', 'give'),
26 'status' => DonationFormStatus::PUBLISHED(),
27 'settings' => FormSettings::fromArray([
28 'enableDonationGoal' => false,
29 'goalAmount' => $this->faker->numberBetween(100, 5000),
30 'enableAutoClose' => false,
31 'registration' => 'none',
32 'goalType' => GoalType::AMOUNT(),
33 'goalSource' => GoalSource::FORM(),
34 'designId' => 'classic',
35 'showHeading' => true,
36 'showDescription' => true,
37 'heading' => __('Support Our Cause', 'give'),
38 'description' => __(
39 'Help our organization by donating today! All donations go directly to making a difference for our cause.',
40 'give'
41 ),
42 'goalAchievedMessage' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'),
43 'inheritCampaignColors' => true,
44 ]),
45 'blocks' => BlockCollection::fromJson($blocksJson),
46 ];
47 }
48 }
49