PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.23.0
GiveWP – Donation Plugin and Fundraising Platform v2.23.0
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 2.31.0 2.31.1 All 253 releases
give / src / FormAPI / Form / Text.php

Text.php in GiveWP – Donation Plugin and Fundraising Platform 2.23.0, at src/FormAPI/Form/Text.php

70 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\FormAPI\Form;
4
5 class Text extends Field
6 {
7 /**
8 * Before field.
9 *
10 * @since 2.7.0
11 * @var string
12 */
13 public $beforeField = '';
14
15 /**
16 * after field.
17 *
18 * @since 2.7.0
19 * @var string
20 */
21 public $afterField = '';
22
23 /**
24 * Field value type.
25 * Note: this param value can be price and decimal.
26 *
27 * @since 2.7.0
28 * @var string
29 */
30 public $dataType = '';
31
32 /**
33 * Field value type.
34 * Note: this param value can be price and decimal.
35 *
36 * @since 2.7.0
37 * @var string
38 */
39 public $size = '';
40
41 /**
42 * @inheritDoc
43 */
44 public function parse($array)
45 {
46 parent::parse($array);
47
48 $this->beforeField = isset($array['before_field']) ? $array['before_field'] : '';
49 $this->afterField = isset($array['after_field']) ? $array['after_field'] : '';
50 $this->dataType = isset($array['data_type']) ? $array['data_type'] : '';
51
52 $type = explode('_', $this->type, 2);
53 $this->size = false !== strpos('_', $this->type) ? array_pop($type) : '';
54 }
55
56 /**
57 * @inheritDoc
58 */
59 public function toArray()
60 {
61 return array_merge(
62 parent::toArray(),
63 [
64 'before_field' => $this->beforeField,
65 'after_field' => $this->afterField,
66 ]
67 );
68 }
69 }
70