<?php
/**
 * Echo widget areas.
 *
 * @package SplendorStudio\Framework\Templates\Fragments
 *
 * @since   1.0.0
 */
class Fancify_Lite_Widget_Area extends Fancify_Lite_Fragments {

	function __construct() {
		$this->register_hook_callbacks();
	}

	/**
	 * Register callbacks for actions and filters
	 *
	 */
	function register_hook_callbacks() {
		Fancify_Lite_Actions::add_smart_action( 'fancify_lite_sidebar_primary', array( $this, 'fancify_lite_widget_area_sidebar_primary' ) );
		Fancify_Lite_Actions::add_smart_action( 'fancify_lite_sidebar_secondary', array( $this, 'fancify_lite_widget_area_sidebar_secondary' ) );
		Fancify_Lite_Actions::add_smart_action( 'fancify_lite_site_after_markup', array( $this, 'fancify_lite_widget_area_offcanvas_menu' ) );
	}

	/**
	 * Echo primary sidebar widget area.
	 *
	 * @since 1.0.0
	 *
	 * @return void
	 */
	public function fancify_lite_widget_area_sidebar_primary() {
		echo fancify_lite_get_widget_area_output( 'sidebar_primary' ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped -- Echoes HTML output.
	}

	/**
	 * Echo secondary sidebar widget area.
	 *
	 * @since 1.0.0
	 *
	 * @return void
	 */
	public function fancify_lite_widget_area_sidebar_secondary() {
		echo fancify_lite_get_widget_area_output( 'sidebar_secondary' ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped -- Echoes HTML output.
	}

	/**
	 * Echo off-canvas widget area.
	 *
	 * @since 1.0.0
	 *
	 * @return void
	 */
	public function fancify_lite_widget_area_offcanvas_menu() {
		if ( ! current_theme_supports( 'offcanvas-menu' ) ) {
			return;
		}

		echo fancify_lite_get_widget_area_output( 'offcanvas_menu' ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped -- Echoes HTML output.
	}

}

new Fancify_Lite_Widget_Area;