diff --git a/packages/netlify-cms-widget-object/src/ObjectControl.js b/packages/netlify-cms-widget-object/src/ObjectControl.js index 019d1f11..058c08de 100644 --- a/packages/netlify-cms-widget-object/src/ObjectControl.js +++ b/packages/netlify-cms-widget-object/src/ObjectControl.js @@ -2,8 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { ClassNames } from '@emotion/core'; -import { Map, List } from 'immutable'; -import { ObjectWidgetTopBar, lengths, colors } from 'netlify-cms-ui-default'; +import { List, Map } from 'immutable'; +import { colors, lengths, ObjectWidgetTopBar } from 'netlify-cms-ui-default'; +import { stringTemplate } from 'netlify-cms-lib-widgets'; const styleStrings = { nestedObjectControl: ` @@ -126,6 +127,13 @@ export default class ObjectControl extends React.Component { return this.controlFor(singleField); }; + objectLabel = () => { + const { value, field } = this.props; + const label = field.get('label', field.get('name')); + const summary = field.get('summary'); + return summary ? stringTemplate.compileStringTemplate(summary, null, '', value) : label; + }; + render() { const { field, forID, classNameWrapper, forList, hasError } = this.props; const collapsed = forList ? this.props.collapsed : this.state.collapsed; @@ -159,6 +167,7 @@ export default class ObjectControl extends React.Component { )}