File Editor
Directories:
.. (Back)
Files:
about-banner.php
about-resume.php
about-us.php
blog-carousel.php
blog-grid.php
clients.php
contact-form.php
contact-information.php
contact-map.php
cta.php
hero-image.php
hero-slider.php
numbers.php
portfolio-carousel.php
portfolio.php
pricing.php
project-image-gallery.php
project-image.php
resume.php
services.php
team.php
testimonials.php
Create New File
Create
Edit File: contact-form.php
<?php namespace Elementor; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Quarty Contact Form Widget. * * @since 1.0 */ class Quarty_Contact_Form_Widget extends Widget_Base { public function get_name() { return 'quarty-contact-form'; } public function get_title() { return esc_html__( 'Contact Form', 'quarty-plugin' ); } public function get_icon() { return 'fas fa-headset'; } public function get_categories() { return [ 'quarty-category' ]; } /** * Register widget controls. * * @since 1.0 */ protected function register_controls() { $this->start_controls_section( 'heading_tab', [ 'label' => esc_html__( 'Title', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'title', [ 'label' => esc_html__( 'Title', 'quarty-plugin' ), 'type' => Controls_Manager::TEXTAREA, 'placeholder' => esc_html__( 'Enter title', 'quarty-plugin' ), 'default' => esc_html__( 'Title', 'quarty-plugin' ), ] ); $this->add_control( 'title_tag', [ 'label' => esc_html__( 'Title Tag', 'quarty-plugin' ), 'type' => Controls_Manager::SELECT, 'default' => 'h4', 'options' => [ 'h1' => __( 'H1', 'quarty-plugin' ), 'h2' => __( 'H2', 'quarty-plugin' ), 'h3' => __( 'H3', 'quarty-plugin' ), 'h4' => __( 'H4', 'quarty-plugin' ), 'div' => __( 'DIV', 'quarty-plugin' ), ], ] ); $this->end_controls_section(); $this->start_controls_section( 'form_tab', [ 'label' => esc_html__( 'Form', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'contact_form', [ 'label' => esc_html__( 'Select CF7 Form', 'quarty-plugin' ), 'type' => Controls_Manager::SELECT, 'default' => 1, 'options' => $this->contact_form_list(), ] ); $this->end_controls_section(); $this->start_controls_section( 'title_styling', [ 'label' => esc_html__( 'Title', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'title_color', [ 'label' => esc_html__( 'Color', 'quarty-plugin' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .qrt-section .qrt-title-h' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .qrt-section .qrt-title-h', ] ); $this->end_controls_section(); $this->start_controls_section( 'form_styling', [ 'label' => esc_html__( 'Form', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'button_color', [ 'label' => esc_html__( 'Button Color', 'quarty-plugin' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .qrt-contact-form .qrt-btn.qrt-btn-color' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_bg_color', [ 'label' => esc_html__( 'Button Background Color', 'quarty-plugin' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .qrt-contact-form .qrt-btn.qrt-btn-color' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'label' => esc_html__( 'Button Typography', 'quarty-plugin' ), 'selector' => '{{WRAPPER}} .qrt-contact-form .qrt-btn.qrt-btn-color', ] ); $this->end_controls_section(); } /** * Render Contact Form List. * * @since 1.0 */ protected function contact_form_list() { $cf7_posts = get_posts( 'post_type="wpcf7_contact_form"&numberposts=-1' ); $cf7_forms = array(); if ( $cf7_posts ) { foreach ( $cf7_posts as $cf7_form ) { $cf7_forms[ $cf7_form->ID ] = $cf7_form->post_title; } } else { $cf7_forms[ esc_html__( 'No contact forms found', 'quarty-plugin' ) ] = 0; } return $cf7_forms; } /** * Render widget output on the frontend. * * @since 1.0 */ protected function render() { $settings = $this->get_settings_for_display(); $this->add_inline_editing_attributes( 'title', 'basic' ); ?> <div class="qrt-section qrt-section-sf"> <div class="row"> <?php if ( $settings['title'] ) : ?> <div class="col-lg-12"> <<?php echo esc_attr( $settings['title_tag'] ); ?> class="qrt-mb-40 qrt-title-h"> <span <?php echo $this->get_render_attribute_string( 'title' ); ?>> <?php echo wp_kses_post( $settings['title'] ); ?> </span> </<?php echo esc_attr( $settings['title_tag'] ); ?>> </div> <?php endif; ?> <?php if ( $settings['contact_form'] ) : ?> <div class="col-lg-12"> <?php echo do_shortcode( '[contact-form-7 id="'. $settings['contact_form'] .'"]' ); ?> </div> <?php endif; ?> </div> </div> <?php } } Plugin::instance()->widgets_manager->register_widget_type( new Quarty_Contact_Form_Widget() );
Save Changes
Rename File
Rename