Skip to content

Commit

Permalink
warn about a common configuration oversight (#4817)
Browse files Browse the repository at this point in the history
  • Loading branch information
boutell authored Dec 10, 2024
1 parent 9c6b6bb commit 9c35a72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## UNRELEASED

### Adds

* When validating an `area` field, warn the developer if `widgets` is not nested in `options`.

### Fixes

* Focus properly Widget Editor modals when opened. Keep the previous active focus on the modal when closing the widget editor.
Expand Down
7 changes: 7 additions & 0 deletions modules/@apostrophecms/schema/lib/addFieldTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ module.exports = (self) => {
return _.isEqual(oneArea, twoArea);
},
validate: function (field, options, warn, fail) {
if (field.widgets) {
warn(stripIndents`
Remember to nest "widgets" inside "options" when configuring an area field.
Otherwise, "widgets" has no effect.
`);
}
let widgets = (field.options && field.options.widgets) || {};

if (field.options && field.options.groups) {
Expand Down

0 comments on commit 9c35a72

Please sign in to comment.