<?php
/**
 * Elementor Footer Subscribe
 *
 * @since 1.0.0
 */
use Elementor\Controls_Manager;
use Elementor\Plugin;
use Elementor\Utils;
use Elementor\Widget_Base;

class Dexen_footer_subscribe extends Widget_Base {
	public function get_name() {
		return 'dexen_footer_subscribe';
	}
	public function get_title() {
		return esc_html__( 'Subscribe bar', 'plugin-name' );
	}
	public function get_icon() {
		return 'fa fa-object-ungroup';
	}
	public function get_categories() {
		return array( 'dexencore' );
	}
	protected function _register_controls() {
		$this->start_controls_section(
			'footer_info',
			array(
				'label' => esc_html__( 'Subscribe Content', 'plugin-name' ),
				'tab'   => \Elementor\Controls_Manager::TAB_CONTENT,
			)
		);
		$this->add_control(
			'content_images',
			array(
				'label'   => __( 'logo', 'plugin-domain' ),
				'type'    => \Elementor\Controls_Manager::MEDIA,
				'default' => array(
					'url' => \Elementor\Utils::get_placeholder_image_src(),
				),
			)
		);
		$this->add_control(
			'site_info',
			array(
				'label'       => esc_html__( 'link list', 'plugin-domain' ),
				'type'        => \Elementor\Controls_Manager::TEXTAREA,
				'placeholder' => esc_html__( 'Type your content here', 'plugin-domain' ),
			)
		);
		$this->add_control(
			'widget_title',
			array(
				'label'       => esc_html__( 'short code for contact from', 'plugin-domain' ),
				'type'        => \Elementor\Controls_Manager::TEXTAREA,
				'placeholder' => esc_html__( 'title', 'plugin-domain' ),
			)
		);
		$this->end_controls_section();
	}
	protected function render() {
		$settings = $this->get_settings_for_display();

		$content_images = ( $settings['content_images']['id'] != '' ) ? wp_get_attachment_url( $settings['content_images']['id'], 'full' ) : $settings['content_images']['url'];
		$site_info      = $settings['site_info'];
		$widget_title   = $settings['widget_title'];
		?>
			<div class="upper-footer">
				<div class="container">
					<div class="row">
						<div class="col-lg-6">
							<div class="content-block">
								<img src="<?php echo esc_url( $content_images ); ?>" alt="Awesome Image" />
								<div class="menu-link">
									<?php echo wp_kses_post( $site_info ); ?>
								</div><!-- /.menu-link -->
							</div><!-- /.content-block -->
						</div><!-- /.col-lg-6 -->
						<div class="col-lg-6">
							<?php
							echo do_shortcode( $widget_title );
							?>
						</div><!-- /.col-lg-6 -->
					</div><!-- /.row -->
				</div><!-- /.container -->
			</div><!-- /.upper-footer -->
		<?php
	}
}

Plugin::instance()->widgets_manager->register_widget_type( new Dexen_footer_subscribe() );
