Merge pull request #466 from netlify/hidden-nested
hide hidden widget in object and list controls
This commit is contained in:
commit
206602436c
@ -72,6 +72,7 @@ collections: # A list of collections the CMS should be able to edit
|
||||
- {label: "Image", name: "image", widget: "image"}
|
||||
- {label: "File", name: "file", widget: "file"}
|
||||
- {label: "Select", name: "select", widget: "select", options: ["a", "b", "c"]}
|
||||
- {label: "Hidden", name: "hidden", widget: "hidden", default: "hidden"}
|
||||
- label: "Object"
|
||||
name: "object"
|
||||
widget: "object"
|
||||
@ -128,6 +129,7 @@ collections: # A list of collections the CMS should be able to edit
|
||||
- {label: "Image", name: "image", widget: "image"}
|
||||
- {label: "File", name: "file", widget: "file"}
|
||||
- {label: "Select", name: "select", widget: "select", options: ["a", "b", "c"]}
|
||||
- {label: "Hidden", name: "hidden", widget: "hidden", default: "hidden"}
|
||||
- label: "Object"
|
||||
name: "object"
|
||||
widget: "object"
|
||||
|
@ -22,6 +22,9 @@ export default class ObjectControl extends Component {
|
||||
|
||||
controlFor(field) {
|
||||
const { onAddAsset, onRemoveAsset, getAsset, value, onChange } = this.props;
|
||||
if (field.get('widget') === 'hidden') {
|
||||
return null;
|
||||
}
|
||||
const widget = resolveWidget(field.get('widget') || 'string');
|
||||
const fieldValue = value && Map.isMap(value) ? value.get(field.get('name')) : value;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user