Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC Document changes to scaffolded fields #540

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions en/08_Changelogs/6.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ title: 6.0.0 (unreleased)

- [Features and enhancements](#features-and-enhancements)
- [Run `CanonicalURLMiddleware` in all environments by default](#url-middleware)
- [Changes to scaffolded form fields](#scaffolded-fields)
- [Other new features](#other-new-features)
- [Bug fixes](#bug-fixes)
- [API changes](#api-changes)
Expand All @@ -31,6 +32,27 @@ CanonicalURLMiddleware::singleton()->setEnabledEnvs([
]);
```

### Changes to scaffolded form fields {#scaffolded-fields}

Some of the form fields have changed when scaffolding form fields for relations.

Previously, `File`, `Image`, and `Folder` were all scaffolded using `UploadField` for `has_one` relations, and `GridField` for `has_many` and `many_many` relations.

All other models used `SearchableDropdownField` for `has_one` relations and `GridField` for `has_many` and `many_many` relations.

|Class|`has_one`|`has_many`|`many_many`|
|---|---|---|---|
|[`SiteTree`](api:SilverStripe\CMS\Model\SiteTree)|[`TreeDropdownField`](api:SilverStripe\Forms\TreeDropdownField)|[`TreeMultiselectField`](api:SilverStripe\Forms\TreeMultiselectField)|[`TreeMultiselectField`](api:SilverStripe\Forms\TreeMultiselectField)|
|[`Group`](api:SilverStripe\Security\Group)|[`TreeDropdownField`](api:SilverStripe\Forms\TreeDropdownField)|[`TreeMultiselectField`](api:SilverStripe\Forms\TreeMultiselectField)|[`TreeMultiselectField`](api:SilverStripe\Forms\TreeMultiselectField)|
|[`Member`](api:SilverStripe\Security\Member)|No change|[`SearchableMultiDropdownField`](api:SilverStripe\Forms\SearchableMultiDropdownField)|[`SearchableMultiDropdownField`](api:SilverStripe\Forms\SearchableMultiDropdownField)|
|[`File`](api:SilverStripe\Assets\File)|No change|[`UploadField`](api:SilverStripe\AssetAdmin\Forms\UploadField)|[`UploadField`](api:SilverStripe\AssetAdmin\Forms\UploadField)|
|[`Image`](api:SilverStripe\Assets\Image)|No change|[`UploadField`](api:SilverStripe\AssetAdmin\Forms\UploadField)|[`UploadField`](api:SilverStripe\AssetAdmin\Forms\UploadField)|
|[`Folder`](api:SilverStripe\Assets\Folder)|[`TreeDropdownField`](api:SilverStripe\Forms\TreeDropdownField)|[`TreeMultiselectField`](api:SilverStripe\Forms\TreeMultiselectField)|[`TreeMultiselectField`](api:SilverStripe\Forms\TreeMultiselectField)|
|[`TaxonomyTerm`](api:SilverStripe\Taxonomy)|No change|[`SearchableMultiDropdownField`](api:SilverStripe\Forms\SearchableMultiDropdownField)|[`SearchableMultiDropdownField`](api:SilverStripe\Forms\SearchableMultiDropdownField)|
|[`Link`](api:SilverStripe\LinkField\Models\Link)|[`LinkField`](api:SilverStripe\LinkField\Form\LinkField)|[`MultiLinkField`](api:SilverStripe\LinkField\Form\MultiLinkField)|No change|
|[`BlogCategory`](api:SilverStripe\Blog\Model\BlogCategory)|No change|[`TagField`](api:SilverStripe\TagField\TagField)|[`TagField`](api:SilverStripe\TagField\TagField)|
|[`BlogTag`](api:SilverStripe\Blog\Model\BlogTag)|No change|[`TagField`](api:SilverStripe\TagField\TagField)|[`TagField`](api:SilverStripe\TagField\TagField)|

### Other new features

- Native indexed PHP arrays can now be passed into templates and iterated over with `<% loop $MyArray %>`. Under the hood they are wrapped in [`ArrayList`](api:SilverStripe\View\ViewableData), so you can get the count using `$Count` and use `<% if $ArrayList %>` as a shortcut for `<% if $ArrayList.Count %>`. Other functionality from `ArrayList` such as filtering and sorting cannot be used on arrays since they don't have keys to filter or sort against.
Expand Down
Loading