AllowMultiple.php
4 years ago
HasDefaultValue.php
4 years ago
HasEmailTag.php
4 years ago
HasHelpText.php
4 years ago
HasLabel.php
4 years ago
HasMaxLength.php
4 years ago
HasMinLength.php
4 years ago
HasName.php
4 years ago
HasNodes.php
4 years ago
HasOptions.php
4 years ago
HasPlaceholder.php
4 years ago
HasType.php
4 years ago
HasVisibilityConditions.php
4 years ago
InsertNode.php
4 years ago
IsReadOnly.php
4 years ago
IsRequired.php
4 years ago
MoveNode.php
4 years ago
MoveNodeProxy.php
4 years ago
NameCollision.php
4 years ago
RemoveNode.php
4 years ago
SerializeAsJson.php
4 years ago
ShowInReceipt.php
4 years ago
StoreAsMeta.php
4 years ago
ValidationRules.php
4 years ago
WalkNodes.php
4 years ago
HasMaxLength.php
38 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Framework\FieldsAPI\Concerns; |
| 4 | |
| 5 | /** |
| 6 | * @since 2.14.0 |
| 7 | * |
| 8 | * @property ValidationRules $validationRules |
| 9 | */ |
| 10 | trait HasMaxLength { |
| 11 | |
| 12 | /** |
| 13 | * Set the value’s maximum length. |
| 14 | * |
| 15 | * @since 2.14.0 |
| 16 | * |
| 17 | * @param int $maxLength |
| 18 | * |
| 19 | * @return $this |
| 20 | */ |
| 21 | public function maxLength( $maxLength ) { |
| 22 | $this->validationRules->rule( 'maxLength', $maxLength ); |
| 23 | |
| 24 | return $this; |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Get the value’s maximum length. |
| 29 | * |
| 30 | * @since 2.14.0 |
| 31 | * |
| 32 | * @return int|null |
| 33 | */ |
| 34 | public function getMaxLength() { |
| 35 | return $this->validationRules->getRule( 'maxLength' ); |
| 36 | } |
| 37 | } |
| 38 |