File: /home/parhudrw/roflma.it/wp-content/plugins/lesya-plugin/elementor/widgets/footer-info.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Lesya Footer Info Widget.
*
* @since 1.0
*/
class Lesya_Footer_Info_Widget extends Widget_Base {
public function get_name() {
return 'lesya-footer-info';
}
public function get_title() {
return esc_html__( 'Footer Info', '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__( 'Heading', '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' ),
]
);
$this->end_controls_section();
$this->start_controls_section(
'items_tab',
[
'label' => esc_html__( 'Items', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'icon', [
'label' => esc_html__( 'Icon', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::ICONS,
]
);
$repeater->add_control(
'label', [
'label' => esc_html__( 'Label', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter label', 'lesya-plugin' ),
'default' => esc_html__( 'Label', 'lesya-plugin' ),
]
);
$repeater->add_control(
'text', [
'label' => esc_html__( 'Text', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::WYSIWYG,
'placeholder' => esc_html__( 'Enter text', 'lesya-plugin' ),
'default' => esc_html__( 'Text', 'lesya-plugin' ),
]
);
$this->add_control(
'items',
[
'label' => esc_html__( 'Items', 'lesya-plugin' ),
'type' => Controls_Manager::REPEATER,
'prevent_empty' => false,
'fields' => $repeater->get_controls(),
'title_field' => '{{{ label }}}',
]
);
$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}} .footer-widget .footer-title' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => esc_html__( 'Title Typography:', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .footer-widget .footer-title',
]
);
$this->add_control(
'item_icon_color',
[
'label' => esc_html__( 'Item Icon Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .footer-widget ul li i' => 'color: {{VALUE}};',
'{{WRAPPER}} .footer-widget ul li svg' => 'fill: {{VALUE}};',
],
]
);
$this->add_control(
'item_label_color',
[
'label' => esc_html__( 'Item Label Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .footer-widget ul li .info-content h5' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_label_typography',
'label' => esc_html__( 'Item Title Typography:', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .footer-widget ul li .info-content h5',
]
);
$this->add_control(
'item_text_color',
[
'label' => esc_html__( 'Item Text Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .footer-widget ul li .info-content div' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_text_typography',
'label' => esc_html__( 'Item Text Typography:', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .footer-widget ul li .info-content div',
]
);
$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' );
?>
<div class="footer-widget contact-widget">
<?php if ( $settings['title'] ) : ?>
<h4 class="footer-title">
<span <?php echo $this->get_render_attribute_string( 'title' ); ?>>
<?php echo wp_kses_post( $settings['title'] ); ?>
</span>
</h4>
<?php endif; ?>
<?php if ( $settings['items'] ) : ?>
<ul>
<?php foreach ( $settings['items'] as $index => $item ) :
$item_label = $this->get_repeater_setting_key( 'label', 'items', $index );
$this->add_inline_editing_attributes( $item_label, 'none' );
$item_text = $this->get_repeater_setting_key( 'text', 'items', $index );
$this->add_inline_editing_attributes( $item_text, 'advanced' );
?>
<li>
<?php if ( $item['icon'] ) :
\Elementor\Icons_Manager::render_icon( $item['icon'], [ 'aria-hidden' => 'true' ] );
endif; ?>
<div class="info-content">
<?php if ( $item['label'] ) : ?>
<h5>
<span <?php echo $this->get_render_attribute_string( $item_label ); ?>>
<?php echo wp_kses_post( $item['label'] ); ?>
</span>
</h5>
<?php endif; ?>
<div <?php echo $this->get_render_attribute_string( $item_text ); ?>>
<?php echo wp_kses_post( $item['text'] ); ?>
</div>
</div>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<?php
}
}
Plugin::instance()->widgets_manager->register_widget_type( new Lesya_Footer_Info_Widget() );