diff --git a/Forms/LiteralField.php b/Forms/LiteralField.php index b53763691..64d618922 100644 --- a/Forms/LiteralField.php +++ b/Forms/LiteralField.php @@ -122,8 +122,7 @@ class LiteralField extends DatalessField { */ public function getSchemaStateDefaults() { $state = parent::getSchemaStateDefaults(); - - $state['data']['content'] = $this->FieldHolder(); + $state['value'] = $this->FieldHolder(); return $state; } diff --git a/Forms/ReadonlyField.php b/Forms/ReadonlyField.php index bbf5a9d7e..f9b3b5ffa 100644 --- a/Forms/ReadonlyField.php +++ b/Forms/ReadonlyField.php @@ -62,10 +62,10 @@ class ReadonlyField extends FormField { } public function getSchemaStateDefaults() { - $values = parent::getSchemaStateDefaults(); - // Suppress `('none')` from appearing in react as a literal - $values['value'] = $this->dataValue(); - return $values; + $state = parent::getSchemaStateDefaults(); + $state['value'] = $this->dataValue(); + + return $state; } diff --git a/admin/client/src/components/LiteralField/LiteralField.js b/admin/client/src/components/LiteralField/LiteralField.js index 464b86231..4cf615ded 100644 --- a/admin/client/src/components/LiteralField/LiteralField.js +++ b/admin/client/src/components/LiteralField/LiteralField.js @@ -8,7 +8,7 @@ class LiteralField extends SilverStripeComponent { * @returns {object} innerHtml */ getContent() { - return { __html: this.props.data.content }; + return { __html: this.props.value }; } /** @@ -41,12 +41,7 @@ LiteralField.propTypes = { id: React.PropTypes.string, name: React.PropTypes.string.isRequired, extraClass: React.PropTypes.string, - data: React.PropTypes.oneOfType([ - React.PropTypes.array, - React.PropTypes.shape({ - content: React.PropTypes.string.isRequired, - }), - ]).isRequired, + value: React.PropTypes.string, }; LiteralField.defaultProps = {