diff --git a/composer.json b/composer.json index 41d2ba36..33633221 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ }, "require-dev": { "silverstripe/frameworktest": "^2", - "dnadesign/silverstripe-elemental": "^6", + "dnadesign/silverstripe-elemental": "6.x-dev", "silverstripe/recipe-testing": "^4", "silverstripe/standards": "^1", "silverstripe/documentation-lint": "^1", diff --git a/docs/en/01_basic_usage.md b/docs/en/01_basic_usage.md index 1a37e5ed..57a66444 100644 --- a/docs/en/01_basic_usage.md +++ b/docs/en/01_basic_usage.md @@ -116,13 +116,13 @@ class MyModel extends DataObject Custom links can have validation set using standard [model validation](https://docs.silverstripe.org/en/developer_guides/forms/validation/#model-validation). This is true both for the validation of the link data itself, as well as validating relations to the `Link` class. -For example you can make sure you have a link in your `has_one` or `has_many` relation using a [`RequiredFields`](api:SilverStripe\Forms\RequiredFields) validator: +For example you can make sure you have a link in your `has_one` or `has_many` relation using a [`RequiredFieldsValidator`](api:SilverStripe\Forms\Validation\RequiredFieldsValidator) validator: ```php namespace App\Model; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; use SilverStripe\LinkField\Models\Link; use SilverStripe\ORM\DataObject; @@ -140,7 +140,7 @@ class MyModel extends DataObject public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['HasOneLink', 'HasManyLinks'])); + $validator->addValidator(RequiredFieldsValidator::create(['HasOneLink', 'HasManyLinks'])); return $validator; } } diff --git a/src/Models/EmailLink.php b/src/Models/EmailLink.php index 2a84053d..ed5d55b3 100644 --- a/src/Models/EmailLink.php +++ b/src/Models/EmailLink.php @@ -4,8 +4,8 @@ use SilverStripe\Forms\EmailField; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; /** * A link to an Email address. @@ -39,7 +39,7 @@ public function getCMSFields(): FieldList public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['Email'])); + $validator->addValidator(RequiredFieldsValidator::create(['Email'])); return $validator; } diff --git a/src/Models/ExternalLink.php b/src/Models/ExternalLink.php index 306519e2..467f448c 100644 --- a/src/Models/ExternalLink.php +++ b/src/Models/ExternalLink.php @@ -3,8 +3,8 @@ namespace SilverStripe\LinkField\Models; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; use SilverStripe\Forms\UrlField; /** @@ -41,7 +41,7 @@ public function getCMSFields(): FieldList public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['ExternalUrl'])); + $validator->addValidator(RequiredFieldsValidator::create(['ExternalUrl'])); return $validator; } diff --git a/src/Models/FileLink.php b/src/Models/FileLink.php index 22dbe175..c62698dc 100644 --- a/src/Models/FileLink.php +++ b/src/Models/FileLink.php @@ -4,8 +4,8 @@ use SilverStripe\Assets\File; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; /** * A link to a File in the CMS @@ -37,7 +37,7 @@ public function getCMSFields(): FieldList public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['File'])); + $validator->addValidator(RequiredFieldsValidator::create(['File'])); return $validator; } diff --git a/src/Models/PhoneLink.php b/src/Models/PhoneLink.php index a89e9534..a809edf7 100644 --- a/src/Models/PhoneLink.php +++ b/src/Models/PhoneLink.php @@ -3,8 +3,8 @@ namespace SilverStripe\LinkField\Models; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; /** * A link to a phone number @@ -34,7 +34,7 @@ public function getCMSFields(): FieldList public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['Phone'])); + $validator->addValidator(RequiredFieldsValidator::create(['Phone'])); return $validator; } diff --git a/src/Models/SiteTreeLink.php b/src/Models/SiteTreeLink.php index b57a6a09..f715d3f7 100644 --- a/src/Models/SiteTreeLink.php +++ b/src/Models/SiteTreeLink.php @@ -8,8 +8,8 @@ use SilverStripe\Forms\FieldList; use SilverStripe\Forms\TextField; use SilverStripe\Forms\TreeDropdownField; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\RequiredFields; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\RequiredFieldsValidator; use SilverStripe\Forms\Tip; /** @@ -91,7 +91,7 @@ public function getCMSFields(): FieldList public function getCMSCompositeValidator(): CompositeValidator { $validator = parent::getCMSCompositeValidator(); - $validator->addValidator(RequiredFields::create(['PageID'])); + $validator->addValidator(RequiredFieldsValidator::create(['PageID'])); return $validator; } diff --git a/tests/php/Controllers/LinkFieldControllerTest/TestPhoneLink.php b/tests/php/Controllers/LinkFieldControllerTest/TestPhoneLink.php index 8328f96a..0ebd8532 100644 --- a/tests/php/Controllers/LinkFieldControllerTest/TestPhoneLink.php +++ b/tests/php/Controllers/LinkFieldControllerTest/TestPhoneLink.php @@ -4,8 +4,8 @@ use SilverStripe\Dev\TestOnly; use SilverStripe\Core\Validation\ValidationResult; -use SilverStripe\Forms\CompositeValidator; -use SilverStripe\Forms\Validator; +use SilverStripe\Forms\Validation\CompositeValidator; +use SilverStripe\Forms\Validation\Validator; use SilverStripe\LinkField\Models\Link; class TestPhoneLink extends Link implements TestOnly