Add mandatory option to First Name field

[MAILPOET-2452]
This commit is contained in:
Pavel Dohnal
2019-12-04 10:31:28 +01:00
committed by Rostislav Wolný
parent 612f436dba
commit 0c1ca572ed
3 changed files with 8 additions and 1 deletions

View File

@@ -25,6 +25,11 @@ const FirstNameEdit = ({ attributes, setAttributes }) => {
checked={attributes.labelWithinInput}
onChange={(labelWithinInput) => (setAttributes({ labelWithinInput }))}
/>
<ToggleControl
label={MailPoet.I18n.t('blockMandatory')}
checked={attributes.mandatory}
onChange={(mandatory) => (setAttributes({ mandatory }))}
/>
</PanelBody>
</Panel>
@@ -61,6 +66,7 @@ FirstNameEdit.propTypes = {
attributes: PropTypes.shape({
label: PropTypes.string.isRequired,
labelWithinInput: PropTypes.bool.isRequired,
mandatory: PropTypes.bool.isRequired,
}).isRequired,
setAttributes: PropTypes.func.isRequired,
};

View File

@@ -20,7 +20,7 @@ export const settings = {
},
mandatory: {
type: 'boolean',
default: true,
default: false,
},
},
supports: {