diff --git a/src/Framework/FieldsAPI/File.php b/src/Framework/FieldsAPI/File.php index 5888c75f82..2393442f9e 100644 --- a/src/Framework/FieldsAPI/File.php +++ b/src/Framework/FieldsAPI/File.php @@ -21,7 +21,6 @@ class File extends Field use Concerns\HasEmailTag; use Concerns\HasHelpText; use Concerns\HasLabel; - use Concerns\AllowMultiple; const TYPE = 'file'; @@ -30,9 +29,9 @@ class File extends Field */ public function maxSize(int $maxSize): File { - if ($this->hasRule('file')) { + if ($this->hasRule(FileRule::id())) { /** @var FileRule $rule */ - $rule = $this->getRule('file'); + $rule = $this->getRule(FileRule::id()); $rule->size($maxSize); } @@ -47,12 +46,12 @@ public function maxSize(int $maxSize): File */ public function getMaxSize(): int { - if (!$this->hasRule('file')) { + if (!$this->hasRule(FileRule::id())) { return wp_max_upload_size(); } /** @var FileRule $rule */ - $rule = $this->getRule('file'); + $rule = $this->getRule(FileRule::id()); return $rule->getSize(); } diff --git a/src/Framework/ValidationRules/Rules/File.php b/src/Framework/ValidationRules/Rules/File.php index 0f54a7b963..c706dcd934 100644 --- a/src/Framework/ValidationRules/Rules/File.php +++ b/src/Framework/ValidationRules/Rules/File.php @@ -44,7 +44,7 @@ public function size(int $size): ValidationRule return $this; } - + /** * @unreleased **/ diff --git a/src/Framework/ValidationRules/ValidationRulesServiceProvider.php b/src/Framework/ValidationRules/ValidationRulesServiceProvider.php index 8b9011e966..6b8aa866d4 100644 --- a/src/Framework/ValidationRules/ValidationRulesServiceProvider.php +++ b/src/Framework/ValidationRules/ValidationRulesServiceProvider.php @@ -5,7 +5,6 @@ namespace Give\Framework\ValidationRules; use Give\Framework\ValidationRules\Rules\AllowedTypes; -use Give\Framework\ValidationRules\Rules\File; use Give\ServiceProviders\ServiceProvider; use Give\Vendors\StellarWP\Validation\ValidationRulesRegistrar; @@ -24,8 +23,7 @@ public function register() public function boot() { give(ValidationRulesRegistrar::class)->register( - AllowedTypes::class, - File::class + AllowedTypes::class ); } }