DonationFormFactory.php
45 lines
| 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\GoalType; |
| 8 | use Give\Framework\Blocks\BlockCollection; |
| 9 | use Give\Framework\Models\Factories\ModelFactory; |
| 10 | |
| 11 | class DonationFormFactory extends ModelFactory |
| 12 | { |
| 13 | /** |
| 14 | * @since 3.0.0 |
| 15 | */ |
| 16 | public function definition(): array |
| 17 | { |
| 18 | $blocksJson = file_get_contents( |
| 19 | GIVE_PLUGIN_DIR . 'src/FormBuilder/resources/js/form-builder/src/blocks.json' |
| 20 | ); |
| 21 | |
| 22 | return [ |
| 23 | 'title' => __('GiveWP Donation Form', 'give'), |
| 24 | 'status' => DonationFormStatus::PUBLISHED(), |
| 25 | 'settings' => FormSettings::fromArray([ |
| 26 | 'enableDonationGoal' => false, |
| 27 | 'goalAmount' => $this->faker->numberBetween(100, 5000), |
| 28 | 'enableAutoClose' => false, |
| 29 | 'registration' => 'none', |
| 30 | 'goalType' => GoalType::AMOUNT(), |
| 31 | 'designId' => 'classic', |
| 32 | 'showHeading' => true, |
| 33 | 'showDescription' => true, |
| 34 | 'heading' => __('Support Our Cause', 'give'), |
| 35 | 'description' => __( |
| 36 | 'Help our organization by donating today! All donations go directly to making a difference for our cause.', |
| 37 | 'give' |
| 38 | ), |
| 39 | 'goalAchievedMessage' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
| 40 | ]), |
| 41 | 'blocks' => BlockCollection::fromJson($blocksJson), |
| 42 | ]; |
| 43 | } |
| 44 | } |
| 45 |