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 / Blocks / DonationFormBlock / DataTransferObjects / BlockAttributes.php

BlockAttributes.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/DonationForms/Blocks/DonationFormBlock/DataTransferObjects/BlockAttributes.php

52 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\DonationForms\Blocks\DonationFormBlock\DataTransferObjects;
4
5 use Give\Framework\Support\Contracts\Arrayable;
6
7 class BlockAttributes implements Arrayable
8 {
9 /**
10 * @var int|null
11 */
12 public $formId;
13 /**
14 * @var string
15 */
16 public $blockId;
17
18 /**
19 * @var string
20 */
21 public $formFormat;
22
23 /**
24 * @var string
25 */
26 public $openFormButton;
27
28 /**
29 * @since 3.2.2 add v3 default for form button.
30 * @since 3.0.0
31 */
32 public static function fromArray(array $array): BlockAttributes
33 {
34 $self = new self();
35
36 $self->formId = !empty($array['formId']) ? (int)$array['formId'] : null;
37 $self->blockId = !empty($array['blockId']) ? (string)$array['blockId'] : null;
38 $self->formFormat = !empty($array['formFormat']) ? (string)$array['formFormat'] : null;
39 $self->openFormButton = !empty($array['openFormButton']) ? (string)$array['openFormButton'] : __('Donate now', 'give');
40
41 return $self;
42 }
43
44 /**
45 * @since 3.0.0
46 */
47 public function toArray(): array
48 {
49 return get_object_vars($this);
50 }
51 }
52