| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Give\Framework\FieldsAPI; |
| 6 |
|
| 7 |
class Consent extends Field |
| 8 |
{ |
| 9 |
use Concerns\HasLabel; |
| 10 |
|
| 11 |
protected $useGlobalSettings; |
| 12 |
protected $checkboxLabel; |
| 13 |
protected $displayType; |
| 14 |
protected $linkText; |
| 15 |
protected $linkUrl; |
| 16 |
protected $modalHeading; |
| 17 |
protected $modalAcceptanceText; |
| 18 |
protected $agreementText; |
| 19 |
|
| 20 |
const TYPE = 'consent'; |
| 21 |
|
| 22 |
/** |
| 23 |
* @since 3.0.0 |
| 24 |
*/ |
| 25 |
public function getUseGlobalSettings(): bool |
| 26 |
{ |
| 27 |
return $this->useGlobalSettings; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* @since 3.0.0 |
| 32 |
*/ |
| 33 |
public function useGlobalSettings(bool $useGlobalSettings): Consent |
| 34 |
{ |
| 35 |
$this->useGlobalSettings = $useGlobalSettings; |
| 36 |
|
| 37 |
return $this; |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* @since 3.0.0 |
| 42 |
*/ |
| 43 |
public function getCheckboxLabel(): string |
| 44 |
{ |
| 45 |
return $this->checkboxLabel; |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* @since 3.0.0 |
| 50 |
*/ |
| 51 |
public function checkboxLabel(string $text): Consent |
| 52 |
{ |
| 53 |
$this->checkboxLabel = $text; |
| 54 |
|
| 55 |
return $this; |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* @since 3.0.0 |
| 60 |
*/ |
| 61 |
public function getDisplayType(): string |
| 62 |
{ |
| 63 |
return $this->displayType; |
| 64 |
} |
| 65 |
|
| 66 |
/** |
| 67 |
* @since 3.0.0 |
| 68 |
*/ |
| 69 |
public function displayType(string $text): Consent |
| 70 |
{ |
| 71 |
$this->displayType = $text; |
| 72 |
|
| 73 |
return $this; |
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 77 |
* @since 3.0.0 |
| 78 |
*/ |
| 79 |
public function getLinkText(): string |
| 80 |
{ |
| 81 |
return $this->linkText; |
| 82 |
} |
| 83 |
|
| 84 |
/** |
| 85 |
* @since 3.0.0 |
| 86 |
*/ |
| 87 |
public function linkText(string $text): Consent |
| 88 |
{ |
| 89 |
$this->linkText = $text; |
| 90 |
|
| 91 |
return $this; |
| 92 |
} |
| 93 |
|
| 94 |
/** |
| 95 |
* @since 3.0.0 |
| 96 |
*/ |
| 97 |
public function getLinkUrl(): string |
| 98 |
{ |
| 99 |
return $this->linkUrl; |
| 100 |
} |
| 101 |
|
| 102 |
/** |
| 103 |
* @since 3.0.0 |
| 104 |
*/ |
| 105 |
public function linkUrl(string $url): Consent |
| 106 |
{ |
| 107 |
$this->linkUrl = $url; |
| 108 |
|
| 109 |
return $this; |
| 110 |
} |
| 111 |
|
| 112 |
/** |
| 113 |
* @since 3.0.0 |
| 114 |
*/ |
| 115 |
public function getModalHeading(): string |
| 116 |
{ |
| 117 |
return $this->modalHeading; |
| 118 |
} |
| 119 |
|
| 120 |
/** |
| 121 |
* @since 3.0.0 |
| 122 |
*/ |
| 123 |
public function modalHeading(string $text): Consent |
| 124 |
{ |
| 125 |
$this->modalHeading = $text; |
| 126 |
|
| 127 |
return $this; |
| 128 |
} |
| 129 |
|
| 130 |
/** |
| 131 |
* @since 3.0.0 |
| 132 |
*/ |
| 133 |
public function getModalAcceptanceText(): string |
| 134 |
{ |
| 135 |
return $this->modalAcceptanceText; |
| 136 |
} |
| 137 |
|
| 138 |
/** |
| 139 |
* @since 3.0.0 |
| 140 |
*/ |
| 141 |
public function modalAcceptanceText(string $text): Consent |
| 142 |
{ |
| 143 |
$this->modalAcceptanceText = $text; |
| 144 |
|
| 145 |
return $this; |
| 146 |
} |
| 147 |
|
| 148 |
/** |
| 149 |
* @since 3.0.0 |
| 150 |
*/ |
| 151 |
public function getAgreementText(): string |
| 152 |
{ |
| 153 |
return $this->agreementText; |
| 154 |
} |
| 155 |
|
| 156 |
/** |
| 157 |
* @since 3.0.0 |
| 158 |
*/ |
| 159 |
public function agreementText(string $text): Consent |
| 160 |
{ |
| 161 |
$this->agreementText = $text; |
| 162 |
|
| 163 |
return $this; |
| 164 |
} |
| 165 |
|
| 166 |
} |
| 167 |
|