File: /home/parhudrw/roflma.it/wp-content/plugins/lesya-plugin/elementor/widgets/footer-social-links.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Lesya Footer Social Links Widget.
*
* @since 1.0
*/
class Lesya_Footer_Social_Links_Widget extends Widget_Base {
public function get_name() {
return 'lesya-footer-social-links';
}
public function get_title() {
return esc_html__( 'Footer Social Links', '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(
'source',
[
'label' => esc_html__( 'Parse From', 'lesya-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 'options',
'options' => [
'options' => __( 'Theme Optios', 'lesya-plugin' ),
'custom' => __( 'Custom', 'lesya-plugin' ),
],
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'icon', [
'label' => esc_html__( 'Icon', 'myour-plugin' ),
'type' => Controls_Manager::ICONS,
'label_block' => true,
]
);
$repeater->add_control(
'title', [
'label' => esc_html__( 'Title', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter title', 'lesya-plugin' ),
'default' => esc_html__( 'Enter title', 'lesya-plugin' ),
]
);
$repeater->add_control(
'link', [
'label' => esc_html__( 'URL', 'lesya-plugin' ),
'label_block' => true,
'type' => Controls_Manager::URL,
'show_external' => true,
'default' => [
'url' => '',
'is_external' => true,
'nofollow' => true,
],
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'items',
[
'label' => esc_html__( 'Custom Items', 'lesya-plugin' ),
'type' => Controls_Manager::REPEATER,
'prevent_empty' => false,
'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
$this->end_controls_section();
$this->start_controls_section(
'content_styling',
[
'label' => esc_html__( 'Footer Social Links', 'lesya-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'link_color',
[
'label' => esc_html__( 'Link Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .social-style-one a' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'link_active_color',
[
'label' => esc_html__( 'Link Hover Color', 'lesya-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .social-style-one a:hover' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'link_typography',
'label' => esc_html__( 'Link Typography:', 'lesya-plugin' ),
'selector' => '{{WRAPPER}} .social-style-one a',
]
);
$this->end_controls_section();
}
/**
* Render widget output on the frontend.
*
* @since 1.0
*/
protected function render() {
$settings = $this->get_settings_for_display();
$social_links = get_field( 'social_links', 'options' );
?>
<?php if ( $settings['source'] == 'options' ) : ?>
<?php if ( $social_links ) : ?>
<div class="social-style-one pt-40">
<?php foreach ( $social_links as $index => $item ) : ?>
<a<?php if ( $item['url'] ) : ?> href="<?php echo esc_url( $item['url'] ); ?>"<?php endif; ?><?php if ( $item['title'] ) : ?> title="<?php echo esc_attr( $item['title'] ); ?>"<?php endif; ?>>
<?php echo wp_kses_post( $item['icon'] ); ?>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php else : ?>
<?php if ( $settings['items'] ) : ?>
<div class="social-style-one pt-40">
<?php foreach ( $settings['items'] as $index => $item ) : ?>
<a<?php if ( $item['link'] ) : ?><?php if ( $item['link']['is_external'] ) : ?> target="_blank"<?php endif; ?><?php if ( $item['link']['nofollow'] ) : ?> rel="nofollow"<?php endif; ?> href="<?php echo esc_url( $item['link']['url'] ); ?>"<?php endif; ?>>
<?php \Elementor\Icons_Manager::render_icon( $item['icon'], [ 'aria-hidden' => 'true' ] ); ?>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php
}
}
Plugin::instance()->widgets_manager->register_widget_type( new Lesya_Footer_Social_Links_Widget() );