File: /home/parhudrw/roflma.it/wp-content/plugins/lesya-plugin/elementor/widgets/started.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Lesya Started Widget.
*
* @since 1.0
*/
class Lesya_Started_Widget extends Widget_Base {
public function get_name() {
return 'lesya-started';
}
public function get_title() {
return esc_html__( 'Started', '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(
'subtitle',
[
'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->add_control(
'button',
[
'label' => esc_html__( 'Button (Text)', '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__( 'Button (URL)', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::URL,
'show_external' => true,
'dynamic' => [
'active' => true,
],
]
);
$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(
'title_styling',
[
'label' => esc_html__( 'Title', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'bg_color',
[
'label' => esc_html__( 'Background Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .hero-section.bg-butter' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .hero-content h1' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => esc_html__( 'Title Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .hero-content h1',
]
);
$this->add_control(
'subtitle_color',
[
'label' => esc_html__( 'Subtitle Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .hero-content .bg-text' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'subtitle_typography',
'label' => esc_html__( 'Subtitle Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .hero-content .bg-text',
]
);
$this->add_control(
'button_color',
[
'label' => esc_html__( 'Button Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .hero-content .theme-btn' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'button_bgcolor',
[
'label' => esc_html__( 'Button BG Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .hero-content .theme-btn' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'button_brcolor',
[
'label' => esc_html__( 'Button Border Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .hero-content .theme-btn' => 'border-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'button_typography',
'label' => esc_html__( 'Button Typography', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .hero-content .theme-btn',
]
);
$this->end_controls_section();
}
/**
* 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( 'button', 'none' );
?>
<!-- Hero Section Start -->
<section class="hero-section rel z-1 bg-butter">
<div class="container">
<div class="row align-items-center">
<div class="col-lg-6 col-md-8 col-sm-10">
<div class="hero-content mt-200 mb-220">
<?php if ( $settings['subtitle'] ) : ?>
<span class="bg-text">
<span <?php echo $this->get_render_attribute_string( 'subtitle' ); ?>>
<?php echo wp_kses_post( $settings['subtitle'] ); ?>
</span>
</span>
<?php endif; ?>
<?php if ( $settings['title'] ) : ?>
<h1 class="wow fadeInUp delay-0-2s title--h">
<span <?php echo $this->get_render_attribute_string( 'title' ); ?>>
<?php echo wp_kses_post( $settings['title'] ); ?>
</span>
</h1>
<?php endif; ?>
<?php if ( $settings['button'] ) : ?>
<div class="hero-btn mt-30 wow fadeInUp delay-0-4s">
<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="theme-btn">
<span <?php echo $this->get_render_attribute_string( 'button' ); ?>>
<?php echo wp_kses_post( $settings['button'] ); ?>
</span>
<i class="fas fa-long-arrow-alt-right"></i>
</a>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php if ( $settings['image'] ) : $image = wp_get_attachment_image_url( $settings['image']['id'], 'lesya_1920xAuto' ); ?>
<div class="hero-right-image" style="background-image: url('<?php echo esc_url( $image ); ?>');"></div>
<?php endif; ?>
</section>
<!-- Hero Section End -->
<?php
}
}
Plugin::instance()->widgets_manager->register_widget_type( new Lesya_Started_Widget() );