@ -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 {
|
||||
<ObjectWidgetTopBar
|
||||
collapsed={collapsed}
|
||||
onCollapseToggle={this.handleCollapseToggle}
|
||||
heading={collapsed && this.objectLabel()}
|
||||
/>
|
||||
)}
|
||||
<div
|
||||
|
Reference in New Issue
Block a user