register_steps_section(); $this->register_fields_section(); $this->register_settings_section(); $this->register_style_form_section(); $this->register_style_fields_section(); $this->register_style_button_section(); $this->register_style_messages_section(); } // ========================================================================= // Content Controls // ========================================================================= private function register_steps_section(): void { $this->start_controls_section( 'section_steps', [ 'label' => __( 'Steps', 'admore-widgets-suite' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'enable_multistep', [ 'label' => __( 'Multi-Step Form', 'admore-widgets-suite' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', ] ); $steps = new Repeater(); $steps->add_control( 'step_title', [ 'label' => __( 'Step Title', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Step', 'admore-widgets-suite' ), ] ); $this->add_control( 'steps', [ 'type' => Controls_Manager::REPEATER, 'fields' => $steps->get_controls(), 'default' => [ [ 'step_title' => __( 'Contact Info', 'admore-widgets-suite' ) ], [ 'step_title' => __( 'Details', 'admore-widgets-suite' ) ], ], 'title_field' => '{{{ step_title }}}', 'condition' => [ 'enable_multistep' => 'yes' ], ] ); $this->end_controls_section(); } private function register_fields_section(): void { $this->start_controls_section( 'section_fields', [ 'label' => __( 'Fields', 'admore-widgets-suite' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $r = new Repeater(); $r->add_control( 'field_id', [ 'label' => __( 'Field ID', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => 'field_1', 'description' => __( 'Unique ID for conditional logic.', 'admore-widgets-suite' ), ] ); $r->add_control( 'field_type', [ 'label' => __( 'Type', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'text', 'options' => [ 'text' => __( 'Text', 'admore-widgets-suite' ), 'email' => __( 'Email', 'admore-widgets-suite' ), 'number' => __( 'Number', 'admore-widgets-suite' ), 'textarea' => __( 'Textarea', 'admore-widgets-suite' ), 'select' => __( 'Select', 'admore-widgets-suite' ), 'radio' => __( 'Radio', 'admore-widgets-suite' ), 'checkbox' => __( 'Checkbox', 'admore-widgets-suite' ), 'file' => __( 'File Upload', 'admore-widgets-suite' ), ], ] ); $r->add_control( 'field_label', [ 'label' => __( 'Label', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Field Label', 'admore-widgets-suite' ), ] ); $r->add_control( 'placeholder', [ 'label' => __( 'Placeholder', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'condition' => [ 'field_type' => [ 'text', 'email', 'number', 'textarea' ] ], ] ); $r->add_control( 'field_required', [ 'label' => __( 'Required', 'admore-widgets-suite' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', ] ); $r->add_control( 'field_options', [ 'label' => __( 'Options (one per line)', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXTAREA, 'default' => "Option 1\nOption 2\nOption 3", 'condition' => [ 'field_type' => [ 'select', 'radio', 'checkbox' ] ], ] ); $r->add_control( 'allowed_types', [ 'label' => __( 'Allowed Extensions', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => 'jpg,jpeg,png,pdf', 'condition' => [ 'field_type' => 'file' ], ] ); $r->add_control( 'step_index', [ 'label' => __( 'Step Index (0-based)', 'admore-widgets-suite' ), 'type' => Controls_Manager::NUMBER, 'default' => 0, 'min' => 0, ] ); $r->add_control( 'column_width', [ 'label' => __( 'Width', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => '100', 'options' => [ '100' => '100%', '50' => '50%', '33' => '33%', '25' => '25%' ], ] ); $r->add_control( 'field_icon', [ 'label' => __( 'Field Icon', 'admore-widgets-suite' ), 'type' => Controls_Manager::ICONS, 'separator' => 'before', 'condition' => [ 'field_type' => [ 'text', 'email', 'number', 'textarea' ] ], ] ); $r->add_control( 'field_icon_position', [ 'label' => __( 'Icon Position', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'prefix', 'options' => [ 'prefix' => __( 'Prefix (Left)', 'admore-widgets-suite' ), 'suffix' => __( 'Suffix (Right)', 'admore-widgets-suite' ), ], 'condition' => [ 'field_type' => [ 'text', 'email', 'number', 'textarea' ] ], ] ); // Conditional logic $r->add_control( 'condition_heading', [ 'label' => __( 'Conditional Logic', 'admore-widgets-suite' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $r->add_control( 'condition_enabled', [ 'label' => __( 'Enable', 'admore-widgets-suite' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', ] ); $r->add_control( 'condition_field', [ 'label' => __( 'Watch Field ID', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'condition' => [ 'condition_enabled' => 'yes' ], ] ); $r->add_control( 'condition_operator', [ 'label' => __( 'Operator', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'equals', 'options' => [ 'equals' => __( '= Equals', 'admore-widgets-suite' ), 'not_equals' => __( '≠ Not Equals', 'admore-widgets-suite' ), 'contains' => __( '⊃ Contains', 'admore-widgets-suite' ), 'not_contains' => __( '⊅ Not Contains', 'admore-widgets-suite' ), 'starts_with' => __( '↦ Starts With', 'admore-widgets-suite' ), 'ends_with' => __( '↤ Ends With', 'admore-widgets-suite' ), 'is_empty' => __( '○ Is Empty', 'admore-widgets-suite' ), 'not_empty' => __( '● Is Not Empty', 'admore-widgets-suite' ), ], 'condition' => [ 'condition_enabled' => 'yes' ], ] ); $r->add_control( 'condition_value', [ 'label' => __( 'Value', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'condition' => [ 'condition_enabled' => 'yes', 'condition_operator' => [ 'equals', 'not_equals', 'contains', 'not_contains', 'starts_with', 'ends_with' ], ], ] ); $this->add_control( 'form_fields', [ 'type' => Controls_Manager::REPEATER, 'fields' => $r->get_controls(), 'default' => [ [ 'field_id' => 'name', 'field_type' => 'text', 'field_label' => __( 'Full Name', 'admore-widgets-suite' ), 'placeholder' => __( 'Enter your full name', 'admore-widgets-suite' ), 'field_required' => 'yes' ], [ 'field_id' => 'email', 'field_type' => 'email', 'field_label' => __( 'Email Address', 'admore-widgets-suite' ), 'placeholder' => __( 'Enter your email address', 'admore-widgets-suite' ), 'field_required' => 'yes' ], [ 'field_id' => 'message', 'field_type' => 'textarea', 'field_label' => __( 'Message', 'admore-widgets-suite' ), 'placeholder' => __( 'Write your message here…', 'admore-widgets-suite' ), 'field_required' => 'yes' ], ], 'title_field' => '<# var t=field_label||field_id; #>{{{ t }}} ({{{ field_type }}})', ] ); $this->end_controls_section(); } private function register_settings_section(): void { $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'admore-widgets-suite' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'form_name', [ 'label' => __( 'Form Name', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Contact Form', 'admore-widgets-suite' ), 'description' => __( 'Used to identify submissions in Form Entries.', 'admore-widgets-suite' ), 'separator' => 'after', ] ); $this->add_control( 'submit_text', [ 'label' => __( 'Submit Text', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Send Message', 'admore-widgets-suite' ) ] ); $this->add_control( 'submit_icon', [ 'label' => __( 'Submit Button Icon', 'admore-widgets-suite' ), 'type' => Controls_Manager::ICONS, ] ); $this->add_control( 'submit_icon_position', [ 'label' => __( 'Icon Position', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'after', 'options' => [ 'before' => __( 'Before Text', 'admore-widgets-suite' ), 'after' => __( 'After Text', 'admore-widgets-suite' ) ], 'condition' => [ 'submit_icon[value]!' => '' ], ] ); $this->add_control( 'next_text', [ 'label' => __( 'Next Text', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Next', 'admore-widgets-suite' ), 'condition' => [ 'enable_multistep' => 'yes' ], 'separator' => 'before' ] ); $this->add_control( 'prev_text', [ 'label' => __( 'Previous Text', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Back', 'admore-widgets-suite' ), 'condition' => [ 'enable_multistep' => 'yes' ] ] ); $this->add_control( 'email_to', [ 'label' => __( 'Send Email To', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => self::default_notify_email(), 'placeholder' => __( 'you@example.com', 'admore-widgets-suite' ), 'description' => __( 'Separate multiple addresses with commas. Leave empty to turn off email notifications.', 'admore-widgets-suite' ), 'separator' => 'before', ] ); $this->add_control( 'email_subject', [ 'label' => __( 'Email Subject', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'New Form Submission', 'admore-widgets-suite' ) ] ); $this->add_control( 'webhook_url', [ 'label' => __( 'Webhook URL', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'placeholder' => 'https://hooks.example.com/...', 'description' => __( 'Each submission is sent here as JSON. Stored on the server only — never shown to visitors.', 'admore-widgets-suite' ), ] ); $this->add_control( 'success_message', [ 'label' => __( 'Success Message', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXTAREA, 'default' => __( 'Thank you! Your message has been received.', 'admore-widgets-suite' ), 'separator' => 'before', ] ); $this->add_control( 'error_message', [ 'label' => __( 'Error Message', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXTAREA, 'default' => __( 'Something went wrong. Please try again.', 'admore-widgets-suite' ), ] ); // ── CAPTCHA ─────────────────────────────────────────────────────────── $this->add_control( 'captcha_heading', [ 'label' => __( 'CAPTCHA', 'admore-widgets-suite' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'enable_captcha', [ 'label' => __( 'Enable CAPTCHA', 'admore-widgets-suite' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'description' => __( 'Configure CAPTCHA type and API keys in Essential Pro Pack → Integrations settings first.', 'admore-widgets-suite' ), ] ); $this->end_controls_section(); } // ========================================================================= // Style Controls // ========================================================================= private function register_style_form_section(): void { $this->start_controls_section( 'style_form', [ 'label' => __( 'Form', 'admore-widgets-suite' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'form_gap', [ 'label' => __( 'Field Gap', 'admore-widgets-suite' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'default' => [ 'size' => 16 ], 'selectors' => [ '{{WRAPPER}} .eppro-form-grid' => '--eppro-form-gap: {{SIZE}}{{UNIT}};' ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'form_shadow', 'selector' => '{{WRAPPER}} .eppro-form-wrap', ] ); $this->add_responsive_control( 'form_padding', [ 'label' => __( 'Padding', 'admore-widgets-suite' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'selectors' => [ '{{WRAPPER}} .eppro-form-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], ] ); $this->add_control( 'form_bg', [ 'label' => __( 'Background', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-form-wrap' => 'background-color: {{VALUE}};' ], ] ); $this->add_control( 'form_radius', [ 'label' => __( 'Border Radius', 'admore-widgets-suite' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .eppro-form-wrap' => 'border-radius: {{SIZE}}{{UNIT}};' ], ] ); $this->end_controls_section(); } private function register_style_fields_section(): void { $this->start_controls_section( 'style_fields', [ 'label' => __( 'Fields', 'admore-widgets-suite' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); // ── Label ────────────────────────────────────────────────────────────── $this->add_control( 'label_position', [ 'label' => __( 'Label Position', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'top', 'options' => [ 'top' => __( 'Above Field', 'admore-widgets-suite' ), 'inline' => __( 'Inline (left)', 'admore-widgets-suite' ), 'hidden' => __( 'Hidden (placeholder only)', 'admore-widgets-suite' ), ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'label_typography', 'label' => __( 'Label Typography', 'admore-widgets-suite' ), 'selector' => '{{WRAPPER}} .eppro-field-label', ] ); $this->add_control( 'label_color', [ 'label' => __( 'Label Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-field-label' => 'color: {{VALUE}};' ], ] ); $this->add_responsive_control( 'label_spacing', [ 'label' => __( 'Label Bottom Spacing', 'admore-widgets-suite' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 30 ] ], 'selectors' => [ '{{WRAPPER}} .eppro-field-label' => 'margin-bottom: {{SIZE}}{{UNIT}};' ], 'condition' => [ 'label_position' => 'top' ], ] ); // ── Input fields ─────────────────────────────────────────────────────── $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'field_typography', 'selector' => '{{WRAPPER}} .eppro-field input, {{WRAPPER}} .eppro-field textarea, {{WRAPPER}} .eppro-field select', 'separator' => 'before', ] ); $this->add_control( 'field_text_color', [ 'label' => __( 'Text Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-field input, {{WRAPPER}} .eppro-field textarea, {{WRAPPER}} .eppro-field select' => 'color: {{VALUE}};' ], ] ); $this->add_control( 'placeholder_color', [ 'label' => __( 'Placeholder Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-field input::placeholder' => 'color: {{VALUE}};', '{{WRAPPER}} .eppro-field textarea::placeholder' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'field_bg', [ 'label' => __( 'Background', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .eppro-field input, {{WRAPPER}} .eppro-field textarea, {{WRAPPER}} .eppro-field select' => 'background-color: {{VALUE}};' ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'field_border', 'selector' => '{{WRAPPER}} .eppro-field input, {{WRAPPER}} .eppro-field textarea, {{WRAPPER}} .eppro-field select', ] ); $this->add_control( 'field_radius', [ 'label' => __( 'Border Radius', 'admore-widgets-suite' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .eppro-field input, {{WRAPPER}} .eppro-field textarea, {{WRAPPER}} .eppro-field select' => 'border-radius: {{SIZE}}{{UNIT}};' ], ] ); $this->add_responsive_control( 'field_padding', [ 'label' => __( 'Padding', 'admore-widgets-suite' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'selectors' => [ '{{WRAPPER}} .eppro-field input, {{WRAPPER}} .eppro-field textarea, {{WRAPPER}} .eppro-field select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], ] ); // ── Field icon style ─────────────────────────────────────────────────── $this->add_control( 'field_icon_heading', [ 'label' => __( 'Field Icon', 'admore-widgets-suite' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'field_icon_color', [ 'label' => __( 'Icon Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#9ca3af', 'selectors' => [ '{{WRAPPER}} .eppro-field-icon i' => 'color: {{VALUE}};', '{{WRAPPER}} .eppro-field-icon svg' => 'fill: {{VALUE}};', ], ] ); $this->add_control( 'field_icon_size', [ 'label' => __( 'Icon Size (px)', 'admore-widgets-suite' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 36 ] ], 'default' => [ 'size' => 16 ], 'selectors' => [ '{{WRAPPER}} .eppro-field-icon i' => 'font-size: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .eppro-field-icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', ], ] ); // ── Focus state ──────────────────────────────────────────────────────── $this->add_control( 'field_focus_heading', [ 'label' => __( 'Focus State', 'admore-widgets-suite' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'field_focus_border_color', [ 'label' => __( 'Border Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#7c3aed', 'selectors' => [ '{{WRAPPER}} .eppro-field input:focus' => 'border-color: {{VALUE}}; outline: none;', '{{WRAPPER}} .eppro-field textarea:focus' => 'border-color: {{VALUE}}; outline: none;', '{{WRAPPER}} .eppro-field select:focus' => 'border-color: {{VALUE}}; outline: none;', ], ] ); $this->add_control( 'field_focus_shadow', [ 'label' => __( 'Glow / Ring Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => 'rgba(124,58,237,0.15)', 'selectors' => [ '{{WRAPPER}} .eppro-field input:focus' => 'box-shadow: 0 0 0 3px {{VALUE}};', '{{WRAPPER}} .eppro-field textarea:focus' => 'box-shadow: 0 0 0 3px {{VALUE}};', '{{WRAPPER}} .eppro-field select:focus' => 'box-shadow: 0 0 0 3px {{VALUE}};', ], ] ); $this->add_control( 'field_focus_bg', [ 'label' => __( 'Background on Focus', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-field input:focus' => 'background-color: {{VALUE}};', '{{WRAPPER}} .eppro-field textarea:focus' => 'background-color: {{VALUE}};', '{{WRAPPER}} .eppro-field select:focus' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'field_error_heading', [ 'label' => __( 'Error / Invalid State', 'admore-widgets-suite' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'field_error_border_color', [ 'label' => __( 'Border Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#ef4444', 'selectors' => [ // The script marks invalid inputs with .eppro-has-error. '{{WRAPPER}} .eppro-field .eppro-input.eppro-has-error' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'field_error_bg', [ 'label' => __( 'Background Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ // The script marks invalid inputs with .eppro-has-error. '{{WRAPPER}} .eppro-field .eppro-input.eppro-has-error' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'field_error_msg_color', [ 'label' => __( 'Error Message Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#ef4444', 'selectors' => [ '{{WRAPPER}} .eppro-field-error' => 'color: {{VALUE}};' ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'field_error_typography', 'label' => __( 'Error Message Typography', 'admore-widgets-suite' ), 'selector' => '{{WRAPPER}} .eppro-field-error', ] ); $this->end_controls_section(); } private function register_style_button_section(): void { $this->start_controls_section( 'style_button', [ 'label' => __( 'Buttons', 'admore-widgets-suite' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'button_tabs' ); $this->start_controls_tab( 'btn_normal', [ 'label' => __( 'Normal', 'admore-widgets-suite' ) ] ); $this->add_control( 'btn_bg', [ 'label' => __( 'Background', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#7c3aed', 'selectors' => [ '{{WRAPPER}} .eppro-form-btn' => 'background-color: {{VALUE}};' ] ] ); $this->add_control( 'btn_color', [ 'label' => __( 'Text Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .eppro-form-btn' => 'color: {{VALUE}};' ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'btn_hover', [ 'label' => __( 'Hover', 'admore-widgets-suite' ) ] ); $this->add_control( 'btn_bg_hover', [ 'label' => __( 'Background', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#6d28d9', 'selectors' => [ '{{WRAPPER}} .eppro-form-btn:hover' => 'background-color: {{VALUE}};' ] ] ); $this->add_control( 'btn_color_hover', [ 'label' => __( 'Text Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-form-btn:hover' => 'color: {{VALUE}};' ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'btn_typography', 'selector' => '{{WRAPPER}} .eppro-form-btn', 'separator' => 'before', ] ); $this->add_responsive_control( 'btn_padding', [ 'label' => __( 'Padding', 'admore-widgets-suite' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'default' => [ 'top' => '12', 'right' => '28', 'bottom' => '12', 'left' => '28', 'unit' => 'px', 'isLinked' => false ], 'selectors' => [ '{{WRAPPER}} .eppro-form-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], ] ); $this->add_control( 'btn_radius', [ 'label' => __( 'Border Radius', 'admore-widgets-suite' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'default' => [ 'size' => 6 ], 'selectors' => [ '{{WRAPPER}} .eppro-form-btn' => 'border-radius: {{SIZE}}{{UNIT}};' ], ] ); $this->add_control( 'btn_width', [ 'label' => __( 'Submit Button Width', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'auto', 'options' => [ 'auto' => __( 'Auto', 'admore-widgets-suite' ), 'full' => __( 'Full Width', 'admore-widgets-suite' ), ], 'separator' => 'before', ] ); $this->add_responsive_control( 'btn_align', [ 'label' => __( 'Alignment', 'admore-widgets-suite' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'admore-widgets-suite' ), 'icon' => 'eicon-text-align-left' ], 'center' => [ 'title' => __( 'Center', 'admore-widgets-suite' ), 'icon' => 'eicon-text-align-center' ], 'flex-end' => [ 'title' => __( 'Right', 'admore-widgets-suite' ), 'icon' => 'eicon-text-align-right' ], ], 'default' => 'flex-start', 'selectors' => [ '{{WRAPPER}} .eppro-form-actions' => 'justify-content: {{VALUE}};' ], 'condition' => [ 'btn_width' => 'auto' ], ] ); $this->end_controls_section(); } private function register_style_messages_section(): void { $this->start_controls_section( 'style_messages', [ 'label' => __( 'Success / Error Messages', 'admore-widgets-suite' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'success_msg_color', [ 'label' => __( 'Success Text Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#15803d', 'selectors' => [ '{{WRAPPER}} .eppro-form-success' => 'color: {{VALUE}};' ], ] ); $this->add_control( 'success_msg_bg', [ 'label' => __( 'Success Background', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#dcfce7', 'selectors' => [ '{{WRAPPER}} .eppro-form-success' => 'background-color: {{VALUE}};' ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'success_msg_typography', 'selector' => '{{WRAPPER}} .eppro-form-success', ] ); $this->add_control( 'error_msg_color', [ 'label' => __( 'Error Text Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#b91c1c', 'separator' => 'before', 'selectors' => [ '{{WRAPPER}} .eppro-form-error-global' => 'color: {{VALUE}};' ], ] ); $this->add_control( 'error_msg_bg', [ 'label' => __( 'Error Background', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#fee2e2', 'selectors' => [ '{{WRAPPER}} .eppro-form-error-global' => 'background-color: {{VALUE}};' ], ] ); $this->add_responsive_control( 'msg_padding', [ 'label' => __( 'Padding', 'admore-widgets-suite' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'default' => [ 'top' => '12', 'right' => '16', 'bottom' => '12', 'left' => '16', 'unit' => 'px' ], 'selectors' => [ '{{WRAPPER}} .eppro-form-success' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .eppro-form-error-global' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->add_control( 'msg_border_radius', [ 'label' => __( 'Border Radius', 'admore-widgets-suite' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'default' => [ 'size' => 6 ], 'selectors' => [ '{{WRAPPER}} .eppro-form-success' => 'border-radius: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .eppro-form-error-global' => 'border-radius: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); } // ========================================================================= // Render // ========================================================================= /** Default recipient: the notification email chosen in the Setup Wizard (if any). */ private static function default_notify_email(): string { if ( ! class_exists( 'EPPRO_Admin_Settings' ) ) return ''; $settings = EPPRO_Admin_Settings::get_settings(); return sanitize_email( (string) ( $settings['wizard_notify_email'] ?? '' ) ); } protected function render(): void { $s = $this->get_settings_for_display(); $fields = EPPRO_Form_Handler::normalize_fields( (array) ( $s['form_fields'] ?? [] ) ); $multistep = ( $s['enable_multistep'] ?? '' ) === 'yes'; $steps = (array) ( $s['steps'] ?? [] ); $widget_id = $this->get_id(); if ( empty( $fields ) ) { if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) { echo '
' . esc_html__( 'Form', 'admore-widgets-suite' ) . '
' . esc_html__( 'Add fields in the Content tab → Form Fields.', 'admore-widgets-suite' ) . '