PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.17.0
GiveWP – Donation Plugin and Fundraising Platform v2.17.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
67 lines 1.2 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 * Before field.
8 *
9 * @since 2.7.0
10 * @var string
11 */
12 public $beforeField = '';
13
14 /**
15 * after field.
16 *
17 * @since 2.7.0
18 * @var string
19 */
20 public $afterField = '';
21
22 /**
23 * Field value type.
24 * Note: this param value can be price and decimal.
25 *
26 * @since 2.7.0
27 * @var string
28 */
29 public $dataType = '';
30
31 /**
32 * Field value type.
33 * Note: this param value can be price and decimal.
34 *
35 * @since 2.7.0
36 * @var string
37 */
38 public $size = '';
39
40 /**
41 * @inheritDoc
42 */
43 public function parse( $array ) {
44 parent::parse( $array );
45
46 $this->beforeField = isset( $array['before_field'] ) ? $array['before_field'] : '';
47 $this->afterField = isset( $array['after_field'] ) ? $array['after_field'] : '';
48 $this->dataType = isset( $array['data_type'] ) ? $array['data_type'] : '';
49
50 $type = explode( '_', $this->type, 2 );
51 $this->size = false !== strpos( '_', $this->type ) ? array_pop( $type ) : '';
52 }
53
54 /**
55 * @inheritDoc
56 */
57 public function toArray() {
58 return array_merge(
59 parent::toArray(),
60 [
61 'before_field' => $this->beforeField,
62 'after_field' => $this->afterField,
63 ]
64 );
65 }
66 }
67