<?php
if (!defined('ABSPATH')) {
    exit;
}

use Elementor\Controls_Manager;
use Elementor\Icons_Manager;
use Elementor\Repeater;
use Elementor\Utils;

class Elementor_ACF_Product_Label extends \Elementor\Widget_Base {

    public function get_name() {
        return 'acf-product-label';
    }

    public function get_title() {
        return esc_html__('ACF Product Label', 'elementor-addon');
    }

    public function get_icon() {
        return 'eicon-code';
    }

    public function get_categories() {
        return ['basic'];
    }

    public function get_keywords() {
        return ['global', 'label'];
    }

    protected function register_controls() {
        $this->start_controls_section(
            'list_section',
            [
                'label' => esc_html__('Setting', 'elementor-addon'),
            ]
        );

        $this->end_controls_section();
    }

    protected function render() {
        $settings = $this->get_settings_for_display();
        $acf_product_label = get_field('label');

        if (empty($acf_product_label) || $acf_product_label == 'BRAK') {
            return;
        }
        ?>
        <div class="product-label">
            <span class="<?php echo strtolower(iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $acf_product_label)); ?>">
                <?php echo $acf_product_label; ?>
            </span>
        </div>
    <?php
    }
}