<?php
namespace Elementor;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Typography;
use Elementor\Repeater;
use Elementor\Scheme_Color;
use Elementor\Scheme_Typography;
use Elementor\Widget_Base;
use Elementor\Utils;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Jet_Elements_Contact_Form7 extends Jet_Elements_Base {
public function get_name() {
return 'contact-form-7';
}
public function get_title() {
return esc_html__( 'Contact Form 7', 'jet-elements' );
}
public function get_icon() {
return 'jet-elements-icon-cf7';
}
public function get_jet_help_url() {
return 'https://crocoblock.com/knowledge-base/articles/how-to-add-contact-form-7-to-the-page-built-with-elementor-using-jetelements-2/';
}
public function get_categories() {
return array( 'cherry' );
}
protected function _register_controls() {
$this->start_controls_section(
'section_settings',
array(
'label' => esc_html__( 'Form', 'jet-elements' ),
)
);
$avaliable_forms = $this->get_availbale_forms();
$active_form = '';
if ( ! empty( $avaliable_forms ) ) {
$active_form = array_keys( $avaliable_forms )[0];
}
$this->add_control( 'form_shortcode', array(
'label' => esc_html__( 'Select Form', 'jet-elements' ),
'type' => Controls_Manager::SELECT,
'default' => $active_form,
'options' => $avaliable_forms,
) );
$this->add_control(
'custom_layout',
array(
'type' => Controls_Manager::RAW_HTML,
'raw' => sprintf(
esc_html__( 'In case you want to create the more complex contact form layout, please, feel free to use %s tool', 'jet-elements' ),
'<a target="_blank" href="https://crocoblock.com/contact-form-7-layout-builder/">' . esc_html__( 'Contact Form 7 Layout Builder', 'jet-elements' ) . '</a>'
)
)
);
$this->end_controls_section();
$this->_start_controls_section(
'section_text_style',
array(
'label' => esc_html__( 'Form Texts', 'jet-elements' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
)
);
$this->_add_control(
'text_color',
array(
'label' => esc_html__( 'Color', 'jet-elements' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .wpcf7 *:not(.wpcf7-form-control):not(option):not(a)' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpcf7 .wpcf7-form-control.wpcf7-file' => 'color: {{VALUE}}',
),
),
25
);
$this->_add_group_control(
Group_Control_Typography::get_type(),
array(
'name' => 'text_typography',
'selector' => '{{WRAPPER}} .wpcf7 *:not(.wpcf7-form-control):not(option), {{WRAPPER}} .wpcf7 .wpcf7-form-control.wpcf7-file',
),
50
);
$this->_add_control(
'invalid_heading',
array(
'label' => esc_html__( 'Not Valid Notices', 'jet-elements' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
),
25
);
$this->_add_control(
'invalid_color',
array(
'label' => esc_html__( 'Color', 'jet-elements' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .wpcf7 span.wpcf7-not-valid-tip' => 'color: {{VALUE}}',
),
),
25
);
$this->_add_group_control(
Group_Control_Typography::get_type(),
array(
'name' => 'invalid_typography',
'selector' => '{{WRAPPER}} .wpcf7 span.wpcf7-not-valid-tip',
),
50
);
$this->_add_responsive_control(
'invalid_notice_margin',
array(
'label' => esc_html__( 'Margin', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%', 'em' ),
'selectors' => array(
'{{WRAPPER}} .wpcf7 span.wpcf7-not-valid-tip' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};display: block;',
),
),
25
);
$this->_add_responsive_control(
'invalid_notice_alignment',
array(
'label' => esc_html__( 'Alignment', 'jet-elements' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'options' => array(
'left' => array(
'title' => esc_html__( 'Left', 'jet-elements' ),
'icon' => 'fa fa-align-left',
),
'center' => array(
'title' => esc_html__( 'Center', 'jet-elements' ),
'icon' => 'fa fa-align-center',
),
'right' => array(
'title' => esc_html__( 'Right', 'jet-elements' ),
'icon' => 'fa fa-align-right',
),
),
'selectors' => array(
'{{WRAPPER}} .wpcf7 span.wpcf7-not-valid-tip' => 'text-align: {{VALUE}};display: block;',
),
),
50
);
$this->_end_controls_section();
$this->_start_controls_section(
'section_inputs_style',
array(
'label' => esc_html__( 'Controls', 'jet-elements' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
)
);
$this->_add_group_control(
Group_Control_Typography::get_type(),
array(
'name' => 'input_typography',
'selector' => '{{WRAPPER}} .wpcf7 .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-checkbox):not(.wpcf7-radio):not(.wpcf7-acceptance):not(.wpcf7-file)',
),
50
);
$this->_add_responsive_control(
'input_padding',
array(
'label' => esc_html__( 'Padding', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%', 'em' ),
'selectors' => array(
'{{WRAPPER}} .wpcf7 .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-checkbox):not(.wpcf7-radio):not(.wpcf7-acceptance):not(.wpcf7-file)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
25
);
$this->_add_responsive_control(
'input_margin',
array(
'label' => esc_html__( 'Margin', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%', 'em' ),
'selectors' => array(
'{{WRAPPER}} .wpcf7 .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-checkbox):not(.wpcf7-radio):not(.wpcf7-acceptance):not(.wpcf7-file)' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
25
);
$this->_add_responsive_control(
'input_border_radius',
array(
'label' => esc_html__( 'Border Radius', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} .wpcf7 .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-checkbox):not(.wpcf7-radio):not(.wpcf7-acceptance):not(.wpcf7-file)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
75
);
$this->_start_controls_tabs( 'tabs_input_style' );
$this->_start_controls_tab(
'tab_input_noraml',
array(
'label' => esc_html__( 'Normal', 'jet-elements' ),
)
);
$this->_add_group_control(
Group_Control_Background::get_type(),
array(
'name' => 'input_background',
'selector' => '{{WRAPPER}} .wpcf7 .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-checkbox):not(.wpcf7-radio):not(.wpcf7-acceptance):not(.wpcf7-file)',
),
25
);
$this->_add_control(
'input_color',
array(
'label' => esc_html__( 'Color', 'jet-elements' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .wpcf7 .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-checkbox):not(.wpcf7-radio):not(.wpcf7-acceptance):not(.wpcf7-file)' => 'color: {{VALUE}}',
),
),
25
);
$this->_add_control(
'input_placeholder_color',
array(
'label' => esc_html__( 'Placeholder Color', 'jet-elements' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .wpcf7 .wpcf7-form .wpcf7-form-control::-webkit-input-placeholder' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpcf7 .wpcf7-form .wpcf7-form-control::-moz-placeholder' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpcf7 .wpcf7-form .wpcf7-form-control:-ms-input-placeholder' => 'color: {{VALUE}}',
),
),
25
);
$this->_add_group_control(
Group_Control_Border::get_type(),
array(
'name' => 'input_border',
'label' => esc_html__( 'Border', 'jet-elements' ),
'placeholder' => '1px',
'selector' => '{{WRAPPER}} .wpcf7 .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-checkbox):not(.wpcf7-radio):not(.wpcf7-acceptance):not(.wpcf7-file)',
),
75
);
$this->_add_group_control(
Group_Control_Box_Shadow::get_type(),
array(
'name' => 'input_box_shadow',
'selector' => '{{WRAPPER}} .wpcf7 .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-checkbox):not(.wpcf7-radio):not(.wpcf7-acceptance):not(.wpcf7-file)',
),
100
);
$this->_end_controls_tab();
$this->_start_controls_tab(
'tab_input_focus',
array(
'label' => esc_html__( 'Focus', 'jet-elements' ),
)
);
$this->_add_group_control(
Group_Control_Background::get_type(),
array(
'name' => 'input_focus_background',
'selector' => '{{WRAPPER}} .wpcf7 .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-checkbox):not(.wpcf7-radio):not(.wpcf7-acceptance):not(.wpcf7-file):focus',
),
25
);
$this->_add_control(
'input_focus_color',
array(
'label' => esc_html__( 'Color', 'jet-elements' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .wpcf7 .wpcf7-form-control:not(.wpcf7-submit):not(.wpcf7-checkbox):not(.wpcf7-radio):not(.wpcf7-acceptance):not(.wpcf7-file):focus' => 'color: {{VALUE}}',
),
),
25
);
$this->_add_control(
'input_placeholder_focus_color',
array(
'label' => esc_html__( 'Placeholder Color', 'jet-elements' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .wpcf7 .wpcf7-form .wpcf7-form-control:focus::-webkit-input-placeholder' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpcf7 .wpcf7-form .wpcf7-form-control:focus::-moz-placeholder' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpcf7 .wpcf7-form .wpcf7-form-control:focus:-ms-input-placeholder' => 'color: {{VALUE}}',
),
),
25
);
$this->_add_group_control(
Group_Control_Border::get_type(),
array(
Loading ...