<?php
/**
 * Widgets.
 *
 * @package MadeByAura\Prime\Plugins\Elementor\Hooks
 * @author  MadeByAura.com
 */

namespace MadeByAura\Prime\Plugins\Elementor\Hooks;

use Elementor\Plugin as Elementor;
use MadeByAura\Prime\Helpers\SingletonTrait;

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

/**
 * Widgets.
 */
class Widgets {
	use SingletonTrait;

	/**
	 * Constructor.
	 */
	protected function __construct() {
		// Register widgets.
		add_action( 'elementor/widgets/register', [ __CLASS__, 'register' ] );
	}

	/**
	 * Register widgets.
	 *
	 * @param \Elementor\Widgets_Manager $manager  Widgets manager.
	 */
	public static function register( $manager ) {
		$widgets = [
			'Button',
			'Hamburger',
			'MenuAccordion',
		];

		foreach ( $widgets as $widget ) {
			$class = 'MadeByAura\\Prime\\Plugins\\Elementor\\Widgets\\' . $widget;

			$manager->register( new $class() );
		}
	}
}
