<?php
/**
 * Template part for displaying sidebar with active widgets
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package errigal
 * @since 1.0.0
 */

defined( 'ABSPATH' ) || exit;

use Errigal\Constant\{
	Errigal_Component_Class as Component_Class,
	Errigal_Html_Attr as Html_Attr,
	Errigal_Html_Option as Html_Option,
	Errigal_Sidebar_Class as Sidebar_Class,
};
use Errigal\Shared\Errigal_Html_Builder as Html_Builder;
use Errigal\Sidebar\Errigal_Sidebar as Sidebar;

if ( ! Sidebar::can_show() ) {
	return;
}

Html_Builder::create()->create_aside(
	array(
		Html_Option::ATTRS => array(
			Html_Attr::ID         => 'secondary',
			Html_Attr::CLASS_NAME => array(
				Sidebar_Class::WIDGET_AREA,
				Component_Class::COL_12,
				Component_Class::COL_XL_4,
			),
		),
	)
)->render_element(
	function () {
		Sidebar::render_sidebar();
	}
);
