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 diff --git a/yarn.lock b/yarn.lock index 28bd5449..c06f13ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -223,7 +223,14 @@ "@babel/template" "^7.25.9" "@babel/types" "^7.26.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.25.9", "@babel/parser@^7.26.0", "@babel/parser@^7.26.2": +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9": + version "7.25.6" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.6.tgz#85660c5ef388cbbf6e3d2a694ee97a38f18afe2f" + integrity sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q== + dependencies: + "@babel/types" "^7.25.6" + +"@babel/parser@^7.25.9", "@babel/parser@^7.26.0", "@babel/parser@^7.26.2": version "7.26.2" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.2.tgz#fd7b6f487cfea09889557ef5d4eeb9ff9a5abd11" integrity sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ== @@ -3069,9 +3076,9 @@ create-jest@^29.7.0: prompts "^2.0.1" cross-spawn@^7.0.2, cross-spawn@^7.0.3: - version "7.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.5.tgz#910aac880ff5243da96b728bc6521a5f6c2f2f82" - integrity sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug== + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== dependencies: path-key "^3.1.0" shebang-command "^2.0.0"