(function ( wpI18n, wpBlocks, wpElement, wpEditor, wpComponents ) {
const { __ } = wpI18n;
const { Component, Fragment } = wpElement;
const { registerBlockType } = wpBlocks;
const { InspectorControls, PanelColorSettings } = wpEditor;
const { PanelBody, RangeControl, SelectControl, TextControl } = wpComponents;
const contactBlockIcon = (
);
class AdvContactForm extends Component {
constructor() {
super( ...arguments );
}
componentWillMount() {
const { attributes, setAttributes } = this.props;
const currentBlockConfig = advgbDefaultConfig['advgb-contact-form'];
// No override attributes of blocks inserted before
if (attributes.changed !== true) {
if (typeof currentBlockConfig === 'object' && currentBlockConfig !== null) {
Object.keys(currentBlockConfig).map((attribute) => {
if (typeof attributes[attribute] === 'boolean') {
attributes[attribute] = !!currentBlockConfig[attribute];
} else {
attributes[attribute] = currentBlockConfig[attribute];
}
});
}
// Finally set changed attribute to true, so we don't modify anything again
setAttributes( { changed: true } );
}
}
render() {
const { attributes, setAttributes } = this.props;
const {
nameLabel,
emailLabel,
msgLabel,
submitLabel,
successLabel,
alertLabel,
bgColor,
textColor,
borderColor,
borderStyle,
borderRadius,
submitColor,
submitBgColor,
submitRadius,
submitPosition,
} = attributes;
return (
{ __( 'We strongly recommend to enable Google reCaptcha to avoid spam bot. You can enable it in Form Recaptcha in' ) }
{ __( 'settings' ) }.
{ __('An email will be sent to the admin email (by default) whenever a contact form is submitted. You can change it in ') }
{ __( 'settings' ) }.