Skip to content

Commit

Permalink
Merge branch '5.0' into 5
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Dec 12, 2024
2 parents aa1c1c4 + 05f320d commit 66f6372
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions docs/en/01_basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Models/EmailLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Models/ExternalLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Models/FileLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Models/PhoneLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Models/SiteTreeLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 11 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 66f6372

Please sign in to comment.