/
home
/
rekodeb
/
webrennes
/
wp-content
/
plugins
/
windfall-core
/
elementor
/
widgets
/
Upload File
HOME
<?php /* * Elementor Windfall Contact Form 7 Widget * Author & Copyright: VictorTheme */ namespace Elementor; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class Windfall_Contact_Form extends Widget_Base{ /** * Retrieve the widget name. */ public function get_name(){ return 'vt-windfall_contact_form'; } /** * Retrieve the widget title. */ public function get_title(){ return esc_html__( 'Contact Form', 'windfall-core' ); } /** * Retrieve the widget icon. */ public function get_icon() { return 'fa fa-wpforms'; } /** * Retrieve the list of categories the widget belongs to. */ public function get_categories() { return ['victortheme-category']; } /** * Retrieve the list of scripts the Windfall Contact Form widget depended on. * Used to set scripts dependencies required to run the widget. */ /* public function get_script_depends() { return ['vt-windfall_contact_form']; } */ /** * Register Windfall Contact Form widget controls. * Adds different input fields to allow the user to change and customize the widget settings. */ protected function register_controls(){ $this->start_controls_section( 'section_contact_form', [ 'label' => esc_html__( 'Form Options', 'windfall-core' ), ] ); $this->add_control( 'form_style', [ 'label' => __( 'Form Style', 'windfall-core' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'style-one' => esc_html__( 'Style One', 'windfall-core' ), 'style-two' => esc_html__( 'Style Two', 'windfall-core' ), ], 'default' => 'style-one', ] ); $this->add_control( 'form_id', [ 'label' => esc_html__( 'Select contact form', 'windfall-core' ), 'type' => Controls_Manager::SELECT, 'options' => Controls_Helper_Output::get_posts('wpcf7_contact_form'), ] ); $this->add_control( 'form_title', [ 'label' => esc_html__( 'Title', 'windfall-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => esc_html__( 'Default title', 'windfall-core' ), 'placeholder' => esc_html__( 'Type your title here', 'windfall-core' ), ] ); $this->end_controls_section();// end: Section // Background $this->start_controls_section( 'section_bg_style', [ 'label' => esc_html__( 'Background', 'windfall-core' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'form_style' => array('style-two'), ], ] ); $this->add_control( 'form_bg_color', [ 'label' => esc_html__( 'Background Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .appointment-form' => 'background: {{VALUE}};', ], ] ); $this->add_control( 'form_borderr_color', [ 'label' => esc_html__( 'Border Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .appointment-form' => 'border-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'form_box_shadow', 'label' => esc_html__( 'Box Shadow', 'windfall-core' ), 'selector' => '{{WRAPPER}} .appointment-form', ] ); $this->add_control( 'box_pad', [ 'label' => __( 'Box Padding', 'windfall-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'selectors' => [ '{{WRAPPER}} .appointment-form' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section();// end: Section // Title $this->start_controls_section( 'section_title_style', [ 'label' => esc_html__( 'Title', 'windfall-core' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'sascont_title_typography', 'selector' => '{{WRAPPER}} .appointment-title', ] ); $this->add_control( 'title_color', [ 'label' => esc_html__( 'Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .appointment-title' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'title_pad', [ 'label' => __( 'Padding', 'windfall-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'selectors' => [ '{{WRAPPER}} .appointment-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section();// end: Section $this->start_controls_section( 'section_form_style', [ 'label' => esc_html__( 'Form', 'windfall-core' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'form_typography', 'selector' => '{{WRAPPER}} .wndfal-cntat-form input[type="text"], {{WRAPPER}} .wndfal-cntat-form input[type="email"], {{WRAPPER}} .wndfal-cntat-form input[type="date"], {{WRAPPER}} .wndfal-cntat-form input[type="time"], {{WRAPPER}} .wndfal-cntat-form input[type="number"], {{WRAPPER}} .wndfal-cntat-form textarea, {{WRAPPER}} .wndfal-cntat-form select, {{WRAPPER}} .wndfal-cntat-form .form-control, {{WRAPPER}} .wndfal-cntat-form .nice-select', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'form_border', 'label' => esc_html__( 'Border', 'windfall-core' ), 'selector' => '{{WRAPPER}} .wndfal-cntat-form input[type="text"], {{WRAPPER}} .wndfal-cntat-form input[type="email"], {{WRAPPER}} .wndfal-cntat-form input[type="date"], {{WRAPPER}} .wndfal-cntat-form input[type="time"], {{WRAPPER}} .wndfal-cntat-form input[type="number"], {{WRAPPER}} .wndfal-cntat-form textarea, {{WRAPPER}} .wndfal-cntat-form select, {{WRAPPER}} .wndfal-cntat-form .form-control, {{WRAPPER}} .wndfal-cntat-form .nice-select', ] ); $this->add_control( 'placeholder_text_color', [ 'label' => __( 'Placeholder Text Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-cntat-form input:not([type="submit"])::-webkit-input-placeholder' => 'color: {{VALUE}} !important;', '{{WRAPPER}} .wndfal-cntat-form input:not([type="submit"])::-moz-placeholder' => 'color: {{VALUE}} !important;', '{{WRAPPER}} .wndfal-cntat-form input:not([type="submit"])::-ms-input-placeholder' => 'color: {{VALUE}} !important;', '{{WRAPPER}} .wndfal-cntat-form input:not([type="submit"])::-o-placeholder' => 'color: {{VALUE}} !important;', '{{WRAPPER}} .wndfal-cntat-form textarea::-webkit-input-placeholder' => 'color: {{VALUE}} !important;', '{{WRAPPER}} .wndfal-cntat-form textarea::-moz-placeholder' => 'color: {{VALUE}} !important;', '{{WRAPPER}} .wndfal-cntat-form textarea::-ms-input-placeholder' => 'color: {{VALUE}} !important;', '{{WRAPPER}} .wndfal-cntat-form textarea::-o-placeholder' => 'color: {{VALUE}} !important;', ], ] ); $this->add_control( 'text_color', [ 'label' => __( 'Text Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-cntat-form input[type="text"], {{WRAPPER}} .wndfal-cntat-form input[type="email"], {{WRAPPER}} .wndfal-cntat-form input[type="date"], {{WRAPPER}} .wndfal-cntat-form input[type="time"], {{WRAPPER}} .wndfal-cntat-form input[type="number"], {{WRAPPER}} .wndfal-cntat-form textarea, {{WRAPPER}} .wndfal-cntat-form select, {{WRAPPER}} .wndfal-cntat-form .form-control, {{WRAPPER}} .wndfal-cntat-form .nice-select' => 'color: {{VALUE}} !important;', ], ] ); $this->end_controls_section();// end: Section $this->start_controls_section( 'section_button_style', [ 'label' => esc_html__( 'Button', 'windfall-core' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'selector' => '{{WRAPPER}} .wndfal-cntat-form .wpcf7 input[type="submit"]', ] ); $this->add_responsive_control( 'btn_width', [ 'label' => esc_html__( 'Width', 'windfall-core' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .wndfal-cntat-form .wpcf7 input[type="submit"]' => 'min-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'btn_margin', [ 'label' => __( 'Margin', 'windfall-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'selectors' => [ '{{WRAPPER}} .wndfal-cntat-form .wpcf7 input[type="submit"]' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'btn_padding', [ 'label' => __( 'Padding', 'windfall-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'selectors' => [ '{{WRAPPER}} .wndfal-cntat-form .wpcf7 input[type="submit"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'button_border_radius', [ 'label' => __( 'Border Radius', 'windfall-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .wndfal-cntat-form .wpcf7 input[type="submit"]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->start_controls_tabs( 'button_style' ); $this->start_controls_tab( 'button_normal', [ 'label' => esc_html__( 'Normal', 'windfall-core' ), ] ); $this->add_control( 'button_color', [ 'label' => esc_html__( 'Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-cntat-form .wpcf7 input[type="submit"]' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_bg_color', [ 'label' => esc_html__( 'Background Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-cntat-form .wpcf7 input[type="submit"]' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_border', 'label' => esc_html__( 'Border', 'windfall-core' ), 'selector' => '{{WRAPPER}} .wndfal-cntat-form .wpcf7 input[type="submit"]', ] ); $this->end_controls_tab(); // end:Normal tab $this->start_controls_tab( 'button_hover', [ 'label' => esc_html__( 'Hover', 'windfall-core' ), ] ); $this->add_control( 'button_hover_color', [ 'label' => esc_html__( 'Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-cntat-form .wpcf7 input[type="submit"]:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_bg_hover_color', [ 'label' => esc_html__( 'Background Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-cntat-form .wpcf7 input[type="submit"]:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_hover_border', 'label' => esc_html__( 'Border', 'windfall-core' ), 'selector' => '{{WRAPPER}} .wndfal-cntat-form .wpcf7 input[type="submit"]:hover', ] ); $this->end_controls_tab(); // end:Hover tab $this->end_controls_tabs(); // end tabs $this->end_controls_section();// end: Section } /** * Render Contact Form widget output on the frontend. * Written in PHP and used to generate the final HTML. */ protected function render() { $settings = $this->get_settings_for_display(); $form_style = !empty( $settings['form_style'] ) ? $settings['form_style'] : []; $form_id = !empty( $settings['form_id'] ) ? $settings['form_id'] : ''; $form_title = !empty( $settings['form_title'] ) ? $settings['form_title'] : ''; if($form_style === 'style-two') { $style_cls = ' appointment-form wndfal-cntat-form wndfal-form'; } else { $style_cls = ' wndfal-contact-form wndfal-form wndfal-cntat-form'; } // Atts If $form_title = ( $form_title ) ? '<h3 class="appointment-title">'. $form_title .'</h3>' : ''; // Starts $output = '<div class="'.$style_cls.'">'; $output .= $form_title; $output .= do_shortcode( '[contact-form-7 id="'. $form_id .'"]' ); $output .= '</div>'; echo $output; } /** * Render Contact Form widget output in the editor. * Written as a Backbone JavaScript template and used to generate the live preview. */ //protected function _content_template(){} } Plugin::instance()->widgets_manager->register_widget_type( new Windfall_Contact_Form() );