PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.8.1
GiveWP – Donation Plugin and Fundraising Platform v4.16.8.1
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 2.31.0 All 254 releases
give / src / Framework / FieldsAPI / MultiSelect.php

MultiSelect.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.8.1, at src/Framework/FieldsAPI/MultiSelect.php

46 lines 896 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Framework\FieldsAPI;
4
5 use InvalidArgumentException;
6
7 /**
8 * @since 3.0.0
9 */
10 class MultiSelect extends Field
11 {
12 use Concerns\AllowMultiple;
13 use Concerns\HasEmailTag;
14 use Concerns\HasHelpText;
15 use Concerns\HasLabel;
16 use Concerns\HasOptions;
17 use Concerns\HasPlaceholder;
18 use Concerns\HasDescription;
19
20 protected $fieldType;
21
22 const TYPE = 'multiSelect';
23
24 /**
25 * @since 3.0.0
26 */
27 public function getFieldType(): string
28 {
29 return $this->fieldType;
30 }
31
32 /**
33 * @since 3.0.0
34 */
35 public function fieldType(string $fieldType): MultiSelect
36 {
37 if (!in_array($fieldType, ['checkbox', 'dropdown'])) {
38 throw new InvalidArgumentException(__('Field type must be either "checkbox" or "dropdown".', 'give'));
39 }
40
41 $this->fieldType = $fieldType;
42
43 return $this;
44 }
45 }
46