AddCampaignFormFromRequest.php
1 year ago
AddNewBadgeToAdminMenuItem.php
1 year ago
ArchiveCampaignFormsAsDraftStatus.php
1 year ago
ArchiveCampaignPagesAsDraftStatus.php
1 year ago
AssignDuplicatedFormToCampaign.php
1 year ago
AssociateCampaignPageWithCampaign.php
1 year ago
ConvertQueryDataToCampaign.php
1 year ago
CreateCampaignPage.php
1 year ago
CreateDefaultCampaignForm.php
1 year ago
CreateDefaultLayoutForCampaignPage.php
1 year ago
EnqueueCampaignPageEditorAssets.php
1 year ago
FormInheritsCampaignGoal.php
1 year ago
LoadCampaignDetailsAssets.php
1 year ago
LoadCampaignOptions.php
1 year ago
LoadCampaignsListTableAssets.php
1 year ago
RedirectLegacyCreateFormToCreateCampaign.php
1 year ago
RegisterCampaignBlocks.php
1 year ago
RegisterCampaignEntity.php
1 year ago
RegisterCampaignIdRestField.php
1 year ago
RenderDonateButton.php
1 year ago
ReplaceGiveFormsCptLabels.php
1 year ago
CreateDefaultLayoutForCampaignPage.php
57 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Campaigns\Actions; |
| 4 | |
| 5 | /** |
| 6 | * @since 4.0.0 |
| 7 | */ |
| 8 | class CreateDefaultLayoutForCampaignPage |
| 9 | { |
| 10 | /** |
| 11 | * @since 4.0.0 |
| 12 | */ |
| 13 | public function getBlocks(): string |
| 14 | { |
| 15 | return '<!-- wp:columns {"style":{"spacing":{"padding":{"top":"0","bottom":"0"}}}} --> |
| 16 | <div class="wp-block-columns" style="padding-top:0;padding-bottom:0"><!-- wp:column {"verticalAlignment":"stretch","width":"60%"} --> |
| 17 | <div class="wp-block-column is-vertically-aligned-stretch" style="flex-basis:60%"><!-- wp:post-featured-image {"aspectRatio":"16/9","width":"100%","height":"100%","style":{"border":{"radius":"8px"}}} /--></div> |
| 18 | <!-- /wp:column --> |
| 19 | |
| 20 | <!-- wp:column {"verticalAlignment":"stretch"} --> |
| 21 | <div class="wp-block-column is-vertically-aligned-stretch"><!-- wp:group {"style":{"dimensions":{"minHeight":"100%"}},"layout":{"type":"flex","orientation":"vertical","verticalAlignment":"space-between","justifyContent":"stretch"}} --> |
| 22 | <div class="wp-block-group" style="min-height:100%"><!-- wp:givewp/campaign-goal {"campaignId":%campaignId%} /--> |
| 23 | |
| 24 | <!-- wp:group {"style":{"layout":{"selfStretch":"fill","flexSize":null}},"layout":{"type":"flex","orientation":"vertical"}} --> |
| 25 | <div class="wp-block-group"><!-- wp:givewp/campaign-stats-block {"campaignId":%campaignId%,"style":{"layout":{"selfStretch":"fit","flexSize":null}}} /--> |
| 26 | |
| 27 | <!-- wp:givewp/campaign-stats-block {"campaignId":%campaignId%,"statistic":"average-donation","style":{"layout":{"selfStretch":"fit","flexSize":null}}} /--></div> |
| 28 | <!-- /wp:group --> |
| 29 | |
| 30 | <!-- wp:givewp/campaign-donate-button {"campaignId":%campaignId%} /--></div> |
| 31 | <!-- /wp:group --></div> |
| 32 | <!-- /wp:column --></div> |
| 33 | <!-- /wp:columns --> |
| 34 | |
| 35 | <!-- wp:paragraph --> |
| 36 | <p>%description%</p> |
| 37 | <!-- /wp:paragraph --> |
| 38 | |
| 39 | <!-- wp:givewp/campaign-donations {"campaignId":%campaignId%} /--> |
| 40 | |
| 41 | <!-- wp:givewp/campaign-donors {"campaignId":%campaignId%} /--> |
| 42 | '; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @since 4.0.0 |
| 47 | */ |
| 48 | public function __invoke(int $campaignId, string $shortDescription): string |
| 49 | { |
| 50 | return str_replace( |
| 51 | ['%campaignId%', '%description%'], |
| 52 | [$campaignId, $shortDescription], |
| 53 | $this->getBlocks() |
| 54 | ); |
| 55 | } |
| 56 | } |
| 57 |