<?php
/**
 * WeCodeArt Framework.
 *
 * WARNING: This file is part of the core WeCodeArt Framework. DO NOT edit this file under any circumstances.
 * Please do all modifications in the form of a child theme.
 *
 * @package 	WeCodeArt Framework
 * @subpackage 	Core\Footer
 * @copyright   Copyright (c) 2025, WeCodeArt Framework
 * @since 		3.5
 * @version		6.6.1
 */

namespace WeCodeArt\Core;

defined( 'ABSPATH' ) || exit;

use WeCodeArt\Config\Traits\Singleton;
use function WeCodeArt\Functions\get_prop;

/**
 * This file serves as fallback for old PHP of way of building themes
 * and plugins who calls footer.php template. Uses WP_Query to render a
 * PHP version of the template from the /block-template-parts/ into footer
 */
class Footer {

	use Singleton;

	/**
	 * Send to Constructor
	 */
	public function init() {
		\add_action( 'wecodeart/footer', [ $this, 'markup' ] );
	}
	
	/**
	 * Output FOOTER markup function Plugin PHP fallback
	 * 
	 * @since 	1.0
	 * @version	6.6.1
	 *
	 * @return 	string 
	 */
	public static function markup( $args = [] ) {
		$args 	= wp_json_encode( wp_parse_args( $args, [ 
			'slug' 		=> 'footer',
			'tagName' 	=> 'footer',
			'className' => 'wp-site-footer'
		] ) );

		echo do_blocks( sprintf( '<!-- wp:template-part %s /-->', $args ) );
	}
}