File: /home/parhudrw/roflma.it/wp-content/plugins/lesya-plugin/elementor/widgets/intro-section.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Lesya Started Widget.
*
* @since 1.0
*/
class Lesya_Intro_Section_Widget extends Widget_Base {
public function get_name() {
return 'lesya-intro-section';
}
public function get_title() {
return esc_html__( 'Intro Section', '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__( 'Background Title', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter title', 'lesya-plugin' ),
'default' => esc_html__( 'Title', 'lesya-plugin' ),
'dynamic' => [
'active' => true,
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'breadcrumbs_tab',
[
'label' => esc_html__( 'Breadcrumbs', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'breadcrumbs',
[
'label' => esc_html__( 'Breadcrumbs', 'lesya-plugin' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => __( 'Yes', 'lesya-plugin' ),
'label_off' => __( 'No', 'lesya-plugin' ),
'return_value' => 'yes',
'default' => 'yes',
]
);
$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__( 'Image', 'lesya-plugin' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
'dynamic' => [
'active' => true,
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'content_styling',
[
'label' => esc_html__( 'Content', '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}} .page-banner h1' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => esc_html__( 'Title Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .page-banner h1',
]
);
$this->add_control(
'bgtext_color',
[
'label' => esc_html__( 'BG text Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .page-banner .bg-text' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'bgtext_typography',
'label' => esc_html__( 'BG text Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .page-banner .bg-text',
]
);
$this->add_control(
'breadcrumb_color',
[
'label' => esc_html__( 'Breadcrumbs Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .page-banner .breadcrumb li' => 'color: {{VALUE}};',
'{{WRAPPER}} .page-banner .breadcrumb li a' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'breadcrumb_typography',
'label' => esc_html__( 'Breadcrumbs Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .page-banner .breadcrumb li',
]
);
$this->end_controls_section();
}
/**
* Render widget output on the frontend.
*
* @since 1.0
*/
protected function render() {
$settings = $this->get_settings_for_display();
$page_id = get_the_ID();
?>
<!-- Page Banner Start -->
<section class="page-banner text-white py-165 rpy-130" <?php if ( $settings['image'] ) : $image = wp_get_attachment_image_url( $settings['image']['id'], 'lesya_1920xAuto' ); ?>style="background-image: url(<?php echo esc_url( $image ); ?>);"<?php endif; ?>>
<div class="container">
<div class="banner-inner">
<?php if ( $settings['bg_text'] ) : ?>
<span class="bg-text">
<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'] ) : ?>
<h1 class="page-title wow fadeInUp delay-0-2s">
<span <?php echo $this->get_render_attribute_string( 'title' ); ?>><?php echo wp_kses_post( $settings['title'] ); ?></span>
</h1>
<?php endif; ?>
<?php if ( $settings['breadcrumbs'] == 'yes' ) : lesya_breadcrumbs( $page_id ); endif; ?>
</div>
</div>
</section>
<!-- Page Banner 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_Intro_Section_Widget() );