Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nzambello committed Apr 22, 2021
1 parent fdd1c13 commit 4e86cfe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,20 @@ import { MultilingualWidget } from 'volto-multilingual-widget'
const CustomWidget = ({ id, value, placeholder, onChange }) => (
<input type="number" id={id} placeholder={placeholder} value={value} onChange={onChange} />
)
const defaultValue = '' // could be any;

export const widgets = {
...defaultWidgets,
id: {
...defaultWidgets.id,
cookie_consent_configuration: MultilingualWidget(CustomWidget),
news_type: MultilingualWidget(CustomWidget),
cookie_consent_configuration: MultilingualWidget(CustomWidget, defaultValue),
},
}
```

If needed, you can pass a second argument for the default value for the custom widget.

Multilingual widget is agnostic about value types and handles the multilingual aspect more than data specific ones.
So you could handle boolean or numeric values, which will be saved in a JSON as described below.

Expand Down

0 comments on commit 4e86cfe

Please sign in to comment.