hide hidden widget in object and list controls

This commit is contained in:
Shawn Erquhart 2017-06-28 16:12:35 -04:00
parent 220e8a6c58
commit 66a683bef1
2 changed files with 5 additions and 0 deletions

View File

@ -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"

View File

@ -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;