PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.8.1
GiveWP – Donation Plugin and Fundraising Platform v4.16.8.1
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 / FormMigration / Actions / MapSettingsToDonationSummary.php

MapSettingsToDonationSummary.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.8.1, at src/FormMigration/Actions/MapSettingsToDonationSummary.php

41 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\FormMigration\Actions;
4
5 use Give\FormMigration\DataTransferObjects\DonationSummarySettings;
6 use Give\Framework\Blocks\BlockCollection;
7
8 class MapSettingsToDonationSummary
9 {
10 /**
11 * @var BlockCollection
12 */
13 protected $blocks;
14
15 public function __construct(BlockCollection $blocks)
16 {
17 $this->blocks = $blocks;
18 }
19
20 public static function make(BlockCollection $blocks)
21 {
22 return new self($blocks);
23 }
24
25 public function __invoke(DonationSummarySettings $settings)
26 {
27 if($settings->isEnabled()){
28 $block = $this->blocks->findByName('givewp/donation-summary');
29 $block->setAttribute('label', $settings->getHeading());
30
31 if($settings->isBeforePaymentFields()) {
32 // Remove and re-insert is the same as "move".
33 $this->blocks->remove('givewp/donation-summary');
34 $this->blocks->insertBefore('givewp/payment-gateways', $block );
35 }
36 } else {
37 $this->blocks->remove('givewp/donation-summary');
38 }
39 }
40 }
41