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

namespace MadeByAura\Prime\Plugins\Elementor\Hooks;

use MadeByAura\Prime\Helpers\SingletonTrait;

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

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

	/**
	 * Constructor.
	 */
	protected function __construct() {
		// Register tags groups and tags.
		add_action( 'elementor/dynamic_tags/register', [ __CLASS__, 'register_tag_groups' ] );
		add_action( 'elementor/dynamic_tags/register', [ __CLASS__, 'register_tags' ] );
	}

	/**
	 * Register tag groups.
	 *
	 * @param \Elementor\Core\DynamicTags\Manager $manager  Dynamic tags manager.
	 */
	public static function register_tag_groups( $manager ) {
		$manager->register_group(
			'aura-theme',
			[
				'title' => esc_html__( 'Aura Theme', 'aura-prime' ),
			],
		);
	}

	/**
	 * Register tags.
	 *
	 * @param \Elementor\Core\DynamicTags\Manager $manager  Dynamic tags manager.
	 */
	public static function register_tags( $manager ) {
		$tags = [
			'FeaturedImage',
			'Preface',
		];

		foreach ( $tags as $tag ) {
			$class = 'MadeByAura\\Prime\\Plugins\\Elementor\\DynamicTags\\' . $tag;

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