<?php
/**
 * Widgets class
 *
 * @package UPPSAE
 */
namespace DynamicLayers\UPPSAE\Classes;

use \Elementor\Plugin as Plugin;

defined( 'ABSPATH' ) || die();

class Widgets {

    /**
     * Initialize
     */
    public function __construct() {
        add_action( 'elementor/widgets/register', [ $this, 'register'] );
    }

    public function get_widgets() {
        return [
            'Pricing_Table'
        ];
    }

    /**
     * Init Widgets
     *
     * widgets register
     * 
     */
    public function register() {
        $widgets = $this->get_widgets();
        if ( $widgets ) {
            foreach ($widgets as $widget){
                $widget_init = '\DynamicLayers\UPPSAE\Widgets\\'. $widget .'\\Widget';
                Plugin::instance()->widgets_manager->register( new $widget_init );
            }
        }

        
    }
}
