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 / Framework / FieldsAPI / LegacyNodes / CheckboxGroup.php

CheckboxGroup.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Framework/FieldsAPI/LegacyNodes/CheckboxGroup.php

54 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\Framework\FieldsAPI\LegacyNodes;
4
5 use Give\Framework\FieldsAPI\Concerns;
6 use Give\Framework\FieldsAPI\Field;
7
8 /**
9 * This class is a legacy node for the old Form Field Manager Checkbox field. It should not be used in any other context
10 * and will be eventually be removed.
11 *
12 * @since 2.28.0 Moved here to discourage future use
13 * @since 2.12.0
14 */
15 class CheckboxGroup extends Field
16 {
17 use Concerns\HasEmailTag;
18 use Concerns\HasHelpText;
19 use Concerns\HasLabel;
20 use Concerns\HasOptions;
21 use Concerns\HasPlaceholder;
22
23 const TYPE = 'legacy-checkbox-group';
24
25 /**
26 * Helper for marking the checkbox as checked by default
27 *
28 * @since 2.12.0
29 *
30 * @param bool|callable $isChecked
31 *
32 * @return $this
33 */
34 public function checked($isChecked = true)
35 {
36 $default = is_callable($isChecked) ? $isChecked() : $isChecked;
37 $this->defaultValue((bool)$default);
38
39 return $this;
40 }
41
42 /**
43 * Returns whether the checkbox is checked by default
44 *
45 * @since 2.12.0
46 *
47 * @return bool
48 */
49 public function isChecked()
50 {
51 return (bool)$this->defaultValue;
52 }
53 }
54