File: //home/parhudrw/roflma.it/wp-content/plugins/lesya-plugin/elementor/widgets/cta-3.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Lesya CTA 3 Widget.
*
* @since 1.0
*/
class Lesya_CTA_Three_Widget extends Widget_Base {
public function get_name() {
return 'lesya-call-to-action-3';
}
public function get_title() {
return esc_html__( 'Call to Action 3', 'lesya-plugin' );
}
public function get_icon() {
return 'eicon-parallax';
}
public function get_categories() {
return [ 'lesya-category' ];
}
/**
* Register widget controls.
*
* @since 1.0
*/
protected function register_controls() {
$this->start_controls_section(
'content_tab',
[
'label' => esc_html__( 'Content', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'title',
[
'label' => esc_html__( 'Title', 'lesya-plugin' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter title', 'lesya-plugin' ),
'default' => esc_html__( 'Title', 'lesya-plugin' ),
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'bg_text',
[
'label' => esc_html__( 'Subtitle', 'lesya-plugin' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter subtitle', 'lesya-plugin' ),
'default' => esc_html__( 'Subtitle', 'lesya-plugin' ),
'dynamic' => [
'active' => true,
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'action_tab',
[
'label' => esc_html__( 'Action', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'button',
[
'label' => esc_html__( 'Button', 'lesya-plugin' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter Button Label', 'lesya-plugin' ),
'default' => esc_html__( 'Button', 'lesya-plugin' ),
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'link',
[
'label' => esc_html__( 'URL', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::URL,
'show_external' => true,
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'contact_form',
[
'label' => esc_html__( 'Select CF7 Form', 'lesya-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 1,
'options' => $this->contact_form_list(),
]
);
$this->end_controls_section();
$this->start_controls_section(
'media_tab',
[
'label' => esc_html__( 'Media', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'image',
[
'label' => esc_html__( 'Background Image', 'lesya-plugin' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
$this->add_control(
'image-circle',
[
'label' => esc_html__( 'Image Circle', 'lesya-plugin' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'content_styling',
[
'label' => esc_html__( 'Content Styling', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .section-title.text-white h2' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => esc_html__( 'Title Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .section-title.text-white h2',
]
);
$this->add_control(
'bgtext_color',
[
'label' => esc_html__( 'BG Text Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .section-title.text-white .sub-title' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'bgtext_typography',
'label' => esc_html__( 'BG Text Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .section-title.text-white .sub-title',
]
);
$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', 'lesya-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' );
$this->add_inline_editing_attributes( 'subtitle', 'basic' );
$this->add_inline_editing_attributes( 'bg_text', 'none' );
?>
<!-- Booking 3 Start -->
<section class="team-page-contact overlay bgs-cover rel py-150 rpt-90 rpb-100" <?php if ( $settings['image'] ) : $image = wp_get_attachment_image_url( $settings['image']['id'], 'full' ); ?>style="background-image: url(<?php echo esc_url( $image ); ?>);"<?php endif; ?>>
<div class="container">
<div class="row">
<?php if ( $settings['bg_text'] || $settings['title'] ) : ?>
<div class="col-lg-5">
<div class="team-contact-left rmb-55 wow fadeInUp delay-0-2s">
<div class="section-title text-white mb-25">
<?php if ( $settings['bg_text'] ) : ?>
<span class="sub-title">
<span <?php echo $this->get_render_attribute_string( 'bg_text' ); ?>>
<?php echo wp_kses_post( $settings['bg_text'] ); ?>
</span>
</span>
<?php endif; ?>
<?php if ( $settings['title'] ) : ?>
<h2>
<span <?php echo $this->get_render_attribute_string( 'title' ); ?>>
<?php echo wp_kses_post( $settings['title'] ); ?>
</span>
</h2>
<?php endif; ?>
</div>
<?php if ( $settings['button'] ) : ?>
<!-- button -->
<a<?php if ( $settings['link'] ) : ?><?php if ( $settings['link']['is_external'] ) : ?> target="_blank"<?php endif; ?><?php if ( $settings['link']['nofollow'] ) : ?> rel="nofollow"<?php endif; ?> href="<?php echo esc_url( $settings['link']['url'] ); ?>"<?php endif; ?> class="read-more">
<span <?php echo $this->get_render_attribute_string( 'button' ); ?>>
<?php echo esc_html( $settings['button'] ); ?>
</span>
<i class="fas fa-long-arrow-alt-right"></i>
</a>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php if ( $settings['contact_form'] ) : ?>
<div class="col-lg-7">
<div class="team-page-form wow fadeInUp delay-0-4s">
<?php echo do_shortcode( '[contact-form-7 id="'. esc_attr( $settings['contact_form'] ) .'"]' ); ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php if ( $settings['image-circle']['url'] ) : $image_circle = wp_get_attachment_image_url( $settings['image-circle']['id'], 'full' ); ?>
<img src="<?php echo esc_url( $image_circle ); ?>" alt="<?php echo esc_attr( $settings['title'] ); ?>" class="team-contact-circle" />
<?php endif; ?>
</section>
<!-- Booking 3 End -->
<?php
}
/**
* Render widget output in the editor.
*
* Written as a Backbone JavaScript template and used to generate the live preview.
*
* @since 1.0.0
* @access protected
*/
/*protected function content_template() { ?>
<?php }*/
}
Plugin::instance()->widgets_manager->register_widget_type( new Lesya_CTA_Three_Widget() );