<?php
/**
 * Registers the fancify default widget areas.
 *
 * @package SplendorStudio\Framework\Render
 *
 * @since   1.0.0
 */

class Fancify_Lite_Widget_Area_Boot extends Fancify_Lite_Controller {

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

	/**
	 * Register callbacks for actions and filters
	 *
	 * @since    1.0.0
	 */
	protected function register_hook_callbacks() {
		Fancify_Lite_Actions::add_smart_action( 'widgets_init', array( $this, 'fancify_lite_do_register_widget_areas' ), 5 );

		/**
		 * Call register sidebar.
		 *
		 * Because the WordPress.org checker doesn't understand that we are using register_sidebar properly,
		 * we have to add this useless call which only has to be declared once.
		 *
		 * @since 1.0.0
		 * @ignore
		 * @access private
		 */
		add_action( 'widgets_init', 'fancify_lite_register_widget_area' );
	}

	/**
	 * Register fancify's default widget areas.
	 *
	 * @since 1.0.0
	 *
	 * @return void
	 */
	public function fancify_lite_do_register_widget_areas() {
		// Keep primary sidebar first for default widget asignment.
		fancify_lite_register_widget_area( 
			array(
				'name' => __( 'Sidebar Primary', 'fancify-lite' ),
				'id'   => 'sidebar_primary',
			) 
		);

		fancify_lite_register_widget_area( 
			array(
				'name' => __( 'Sidebar Secondary', 'fancify-lite' ),
				'id'   => 'sidebar_secondary',
			) 
		);

		fancify_lite_register_widget_area(
			array(
				'name' => __( 'Footer', 'fancify-lite' ),
				'id'   => 'footer_widgets_column',
			)
		);
	}

}

Fancify_Lite_Widget_Area_Boot::get_instance();
