navasena/wp-content/plugins/thinkai-plugin/elementor/contact_us.php

263 lines
7.6 KiB
PHP
Raw Permalink Normal View History

2024-07-31 13:12:38 +07:00
<?php namespace THINKAIPLUGIN\Element;
use Elementor\Controls_Manager;
use Elementor\Controls_Stack;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Border;
use Elementor\Repeater;
use Elementor\Widget_Base;
use Elementor\Utils;
use Elementor\Group_Control_Text_Shadow;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Background;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Group_Control_Text_Stroke;
use Elementor\Plugin;
/**
* Elementor button widget.
* Elementor widget that displays a button with the ability to control every
* aspect of the button design.
*
* @since 1.0.0
*/
class Contact_Us extends Widget_Base {
/**
* Get widget name.
* Retrieve button widget name.
*
* @since 1.0.0
* @access public
* @return string Widget name.
*/
public function get_name() {
return 'thinkai_contact_us';
}
/**
* Get widget title.
* Retrieve button widget title.
*
* @since 1.0.0
* @access public
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Thinkai Contact Us', 'thinkai' );
}
/**
* Get widget icon.
* Retrieve button widget icon.
*
* @since 1.0.0
* @access public
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-form-horizontal';
}
/**
* Get widget categories.
* Retrieve the list of categories the button widget belongs to.
* Used to determine where to display the widget in the editor.
*
* @since 2.0.0
* @access public
* @return array Widget categories.
*/
public function get_categories() {
return [ 'thinkai' ];
}
/**
* Register button widget controls.
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @since 1.0.0
* @access protected
*/
protected function register_controls() {
$this->start_controls_section(
'contact_us',
[
'label' => esc_html__( 'Thinkai Contact Us', 'thinkai' ),
]
);
//Shape img
$this->add_control(
'shape_img',
[
'label' => __( 'Shape Image', 'thinkai' ),
'type' => Controls_Manager::MEDIA,
'default' => ['url' => Utils::get_placeholder_image_src(),],
]
);
//show_particles
$this->add_control(
'show_particles',
[
'label' => esc_html__( 'Enable Particles', 'thinkai' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'On', 'thinkai' ),
'label_off' => esc_html__( 'Off', 'thinkai' ),
'return_value' => 'yes',
'default' => 'no',
]
);
//features_list
$this->add_control(
'features_list',
[
'label' => __( 'Feature List', 'thinkai' ),
'label_block' => true,
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'placeholder' => __( 'Enter your List', 'thinkai' ),
]
);
//Feature img
$this->add_control(
'feature_img',
[
'label' => __( 'Feature Image', 'thinkai' ),
'type' => Controls_Manager::MEDIA,
'default' => ['url' => Utils::get_placeholder_image_src(),],
]
);
//Sub Title
$this->add_control(
'subtitle',
[
'label' => __( 'Sub Title', 'thinkai' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => esc_html__( '[ SEND A MESSAGE ]', 'thinkai' ),
]
);
//Title
$this->add_control(
'title',
[
'label' => __( 'Title', 'thinkai' ),
'label_block' => true,
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'placeholder' => __( 'Enter your title', 'thinkai' ),
]
);
//Form Array
$this->add_control(
'cf7_shortocde',
[
'label' => esc_html__('Select Contact Form 7', 'thinkai'),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => get_contact_form_7_list(),
]
);
$this->end_controls_section();
}
/**
* Render button widget output on the frontend.
* Written in PHP and used to generate the final HTML.
*
* @since 1.0.0
* @access protected
*/
protected function render() {
$settings = $this->get_settings_for_display();
$allowed_tags = wp_kses_allowed_html('post');
?>
<!--Start Main Contact Form -->
<section class="main-contact-form">
<?php if($settings['shape_img']){ ?>
<div class="main-contact-form__shape1">
<img class="float-bob-y" src="<?php echo esc_url(wp_get_attachment_url($settings['shape_img']['id'])); ?>" alt="<?php bloginfo( 'name' ); ?>">
</div>
<?php } ?>
<?php if($settings['show_particles']){ ?>
<div id="particles-js"></div>
<?php } ?>
<?php
$features_list = $settings['features_list'];
if(!empty($features_list)){
$features_list = explode("\n", ($features_list));
?>
<div class="scrolling-text-style6">
<div class="inner">
<ul class="clearfix marquee_mode">
<?php foreach($features_list as $features): ?>
<li data-hover="<?php echo wp_kses($features, true); ?>">
<?php echo wp_kses($features, true); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php } ?>
<div class="container">
<div class="row">
<?php if($settings['feature_img']){ ?>
<div class="col-xl-6 col-lg-5">
<div class="main-contact-form__img-box">
<div class="inner">
<img src="<?php echo esc_url(wp_get_attachment_url($settings['feature_img']['id'])); ?>" alt="<?php bloginfo( 'name' ); ?>">
</div>
</div>
</div>
<?php } ?>
<div class="col-xl-6 col-lg-7">
<div class="main-contact-form__inner">
<?php if($settings['subtitle'] || $settings['title']){ ?>
<div class="sec-title sec-title-animation animation-style2">
<?php if($settings['subtitle']){ ?>
<div class="sub-title">
<h4><?php echo wp_kses($settings['subtitle'], true); ?></h4>
</div>
<?php } ?>
<?php if($settings['title']){ ?>
<h2 class="title-animation">
<?php echo wp_kses($settings['title'], true); ?>
</h2>
<?php } ?>
</div>
<?php } ?>
<?php if($settings['cf7_shortocde']){ ?>
<div class="contact-form">
<div id="contact-form" class="default-form2">
<?php echo do_shortcode('[contact-form-7 id="'.esc_attr($settings['cf7_shortocde']).'"]'); ?>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</section>
<!--End Main Contact Form-->
<?php
}
}