landing-klikaset/wp-content/plugins/ht-contactform/include/elementor_widgets.php

715 lines
35 KiB
PHP

<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class HTContactForm_Elementor_Widget extends Widget_Base {
public function get_name() {
return 'htcontactform-addons';
}
public function get_title() {
return __( 'HT Contact Form 7', 'ht-contactform' );
}
public function get_icon() {
return 'eicon-mail';
}
public function get_categories() {
return [ 'general' ];
}
public function htcontactform_forms(){
$formlist = array();
$forms_args = array( 'posts_per_page' => -1, 'post_type'=> 'wpcf7_contact_form' );
$forms = get_posts( $forms_args );
if( $forms ){
foreach ( $forms as $form ){
$formlist[$form->ID] = $form->post_title;
}
}else{
$formlist['0'] = __('Form not found','ht-contactform');
}
return $formlist;
}
protected function register_controls() {
$this->start_controls_section(
'contactform_content',
[
'label' => __( 'Contact Form', 'ht-contactform' ),
]
);
$this->add_control(
'contact_form_id',
[
'label' => __( 'Select Form', 'ht-contactform' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => $this->htcontactform_forms(),
'default' => '0',
]
);
$this->end_controls_section();
// Style tab section
$this->start_controls_section(
'contactform_form_section_style',
[
'label' => __( 'Style', 'ht-contactform' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'contactform_form_section_padding',
[
'label' => __( 'Padding', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .htcontact-form-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' =>'before',
]
);
$this->add_responsive_control(
'contactform_form_section_margin',
[
'label' => __( 'Margin', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .htcontact-form-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' =>'before',
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'contactform_form_section_background',
'label' => __( 'Background', 'ht-contactform' ),
'types' => [ 'classic', 'gradient' ],
'selector' => '{{WRAPPER}} .htcontact-form-wrapper',
]
);
$this->add_responsive_control(
'contactform_form_section_align',
[
'label' => __( 'Alignment', 'ht-contactform' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __( 'Left', 'ht-contactform' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => __( 'Center', 'ht-contactform' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => __( 'Right', 'ht-contactform' ),
'icon' => 'eicon-text-align-right',
],
'justify' => [
'title' => __( 'Justified', 'ht-contactform' ),
'icon' => 'eicon-text-align-justify',
],
],
'selectors' => [
'{{WRAPPER}} .htcontact-form-wrapper' => 'text-align: {{VALUE}};',
],
'default' => 'left',
'separator' =>'before',
]
);
$this->end_controls_section();
// Input Field style tab start
$this->start_controls_section(
'contactform_contactform_input_style',
[
'label' => __( 'Input', 'ht-contactform' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'contactform_input_box_height',
[
'label' => __( 'Height', 'ht-contactform' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 150,
],
],
'default' => [
'size' => 55,
],
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="text"]' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="email"]' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="url"]' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="number"]' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="tel"]' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="date"]' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap .wpcf7-select' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'contactform_input_box_background',
[
'label' => __( 'Background Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="text"]' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="email"]' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="url"]' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="number"]' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="tel"]' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="date"]' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap .wpcf7-select' => 'background-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'contactform_input_box_typography',
'selector' => '{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="text"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="email"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="url"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="number"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="tel"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="date"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap .wpcf7-select',
]
);
$this->add_control(
'contactform_input_box_text_color',
[
'label' => __( 'Text Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="text"]' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="email"]' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="url"]' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="number"]' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="tel"]' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="date"]' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap .wpcf7-select' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'contactform_input_box_placeholder_color',
[
'label' => __( 'Placeholder Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="text"]::-webkit-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="text"]::-moz-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="text"]:-ms-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="email"]::-webkit-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="email"]::-moz-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="email"]:-ms-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="url"]::-webkit-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="url"]::-moz-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="url"]:-ms-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="number"]::-webkit-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="number"]::-moz-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="number"]:-ms-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="tel"]::-webkit-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="tel"]::-moz-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="tel"]:-ms-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="date"]::-webkit-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="date"]::-moz-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="date"]:-ms-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap .wpcf7-select' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'contactform_input_box_border',
'label' => __( 'Border', 'ht-contactform' ),
'selector' => '{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="text"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="email"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="url"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="number"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="tel"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="date"], {{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap .wpcf7-select',
]
);
$this->add_responsive_control(
'contactform_input_box_border_radius',
[
'label' => __( 'Border Radius', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="text"]' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="email"]' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="url"]' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="number"]' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="tel"]' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="date"]' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap .wpcf7-select' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
],
'separator' =>'before',
]
);
$this->add_responsive_control(
'contactform_input_box_padding',
[
'label' => __( 'Padding', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="text"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="email"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="url"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="number"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="tel"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="date"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap .wpcf7-select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' =>'before',
]
);
$this->add_responsive_control(
'contactform_input_box_margin',
[
'label' => __( 'Margin', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="text"]' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="email"]' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="url"]' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="number"]' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="tel"]' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap input[type*="date"]' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap .wpcf7-select' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' =>'before',
]
);
$this->end_controls_section(); // Input Field style tab end
// Textarea style tab start
$this->start_controls_section(
'contactform_textarea_style',
[
'label' => __( 'Textarea', 'ht-contactform' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'contactform_textarea_box_height',
[
'label' => __( 'Height', 'ht-contactform' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 500,
],
],
'default' => [
'size' => 175,
],
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap textarea' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'contactform_textarea_box_background',
[
'label' => __( 'Background Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap textarea' => 'background-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'contactform_textarea_box_typography',
'selector' => '{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap textarea',
]
);
$this->add_control(
'contactform_textarea_box_text_color',
[
'label' => __( 'Text Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap textarea' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'contactform_textarea_box_placeholder_color',
[
'label' => __( 'Placeholder Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap textarea::-webkit-input-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap textarea::-moz-placeholder' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap textarea:-ms-input-placeholder' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'contactform_textarea_box_border',
'label' => __( 'Border', 'ht-contactform' ),
'selector' => '{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap textarea',
]
);
$this->add_responsive_control(
'contactform_textarea_box_border_radius',
[
'label' => __( 'Border Radius', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap textarea' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
],
'separator' =>'before',
]
);
$this->add_responsive_control(
'contactform_textarea_box_padding',
[
'label' => __( 'Padding', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap textarea' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' =>'before',
]
);
$this->add_responsive_control(
'contactform_textarea_box_margin',
[
'label' => __( 'Margin', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-form-control-wrap textarea' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' =>'before',
]
);
$this->end_controls_section(); // Textarea style tab end
// Label style tab start
$this->start_controls_section(
'contactform_contactform_label_style',
[
'label' => __( 'Label', 'ht-contactform' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'contactform_label_background',
[
'label' => __( 'Background Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .htcontact-form-wrapper form.wpcf7-form label' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'contactform_label_text_color',
[
'label' => __( 'Text Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .htcontact-form-wrapper form.wpcf7-form label' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'contactform_label_typography',
'selector' => '{{WRAPPER}} .htcontact-form-wrapper form.wpcf7-form label',
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'contactform_label_border',
'label' => __( 'Border', 'ht-contactform' ),
'selector' => '{{WRAPPER}} .htcontact-form-wrapper form.wpcf7-form label',
]
);
$this->add_responsive_control(
'contactform_label_border_radius',
[
'label' => __( 'Border Radius', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'selectors' => [
'{{WRAPPER}} .htcontact-form-wrapper form.wpcf7-form label' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
],
'separator' =>'before',
]
);
$this->add_responsive_control(
'contactform_label_padding',
[
'label' => __( 'Padding', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .htcontact-form-wrapper form.wpcf7-form label' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' =>'before',
]
);
$this->add_responsive_control(
'contactform_label_margin',
[
'label' => __( 'Margin', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .htcontact-form-wrapper form.wpcf7-form label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' =>'before',
]
);
$this->end_controls_section(); // // Label style tab end
// Input submit button style tab start
$this->start_controls_section(
'contactform_inputsubmit_style',
[
'label' => __( 'Button', 'ht-contactform' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs('submit_style_tabs');
// Button Normal tab start
$this->start_controls_tab(
'submit_style_normal_tab',
[
'label' => __( 'Normal', 'ht-contactform' ),
]
);
$this->add_control(
'input_submit_height',
[
'label' => __( 'Height', 'ht-contactform' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 150,
],
],
'default' => [
'size' => 55,
],
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-submit' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'input_submit_typography',
'selector' => '{{WRAPPER}} .wpcf7-form .wpcf7-submit',
]
);
$this->add_control(
'input_submit_text_color',
[
'label' => __( 'Text Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-submit' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'input_submit_background_color',
[
'label' => __( 'Background Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-submit' => 'background-color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'input_submit_padding',
[
'label' => __( 'Padding', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' =>'before',
]
);
$this->add_responsive_control(
'input_submit_margin',
[
'label' => __( 'Margin', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-submit' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' =>'before',
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'input_submit_border',
'label' => __( 'Border', 'ht-contactform' ),
'selector' => '{{WRAPPER}} .wpcf7-form .wpcf7-submit',
]
);
$this->add_responsive_control(
'input_submit_border_radius',
[
'label' => __( 'Border Radius', 'ht-contactform' ),
'type' => Controls_Manager::DIMENSIONS,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-submit' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
],
'separator' =>'before',
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'htmega_input_submit_box_shadow',
'label' => __( 'Box Shadow', 'ht-contactform' ),
'selector' => '{{WRAPPER}} .wpcf7-form .wpcf7-submit',
]
);
$this->end_controls_tab(); // Button Normal tab end
// Button Hover tab start
$this->start_controls_tab(
'submit_style_hover_tab',
[
'label' => __( 'Hover', 'ht-contactform' ),
]
);
$this->add_control(
'input_submithover_text_color',
[
'label' => __( 'Text Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-submit:hover' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'input_submithover_background_color',
[
'label' => __( 'Background Color', 'ht-contactform' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpcf7-form .wpcf7-submit:hover' => 'background-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'input_submithover_border',
'label' => __( 'Border', 'ht-contactform' ),
'selector' => '{{WRAPPER}} .wpcf7-form .wpcf7-submit:hover',
]
);
$this->end_controls_tab(); // Button Hover tab end
$this->end_controls_tabs();
$this->end_controls_section(); // Input submit button style tab end
}
protected function render( $instance = [] ) {
$settings = $this->get_settings_for_display();
$id = $this->get_id();
$this->add_render_attribute( 'htwpform_attr', 'class', 'htcontact-form-wrapper' );
$this->add_render_attribute( 'shortcode', 'id', $settings['contact_form_id'] );
$shortcode = sprintf( '[contact-form-7 %s]', $this->get_render_attribute_string( 'shortcode' ) );
?>
<div <?php echo $this->get_render_attribute_string('htwpform_attr'); ?> >
<?php
if( !empty( $settings['contact_form_id'] ) ){
echo do_shortcode( $shortcode );
}else{
echo '<div class="form_no_select">' .__('Please Select contact form.','ht-contactform'). '</div>';
}
?>
</div>
<?php
}
}
Plugin::instance()->widgets_manager->register_widget_type( new HTContactForm_Elementor_Widget() );