<?php
/**
 * Abstract Header Widget class for Header Header Grid.
 *
 * Name:    Header Header Grid
 * Author:  
 *
 * @version 1.0.0
 * @package HFG
 */

namespace HFG\Core\Components;

use HFG\Main;
use WP_Customize_Manager;

/**
 * Class Abstract_HeaderWidget
 *
 * @package HFG\Core\Components
 */
abstract class Abstract_HeaderWidget extends Abstract_Component {

	/**
	 * Method to show header widget
	 *
	 * @param bool   $active Is active.
	 * @param object $section The section id.
	 *
	 * @return bool
	 * @since   1.0.0
	 * @access  public
	 */
	public function header_widgets_show( $active, $section ) {
		if (isset($section->id) && is_string($section->id) && strpos($section->id, 'widgets-header-') !== false) {

			$active = true;
		}

		return $active;
	}

	// /**
	//  * Method to show header widget
	//  *
	//  * @param bool   $active Is active.
	//  * @param object $section The section id.
	//  *
	//  * @return bool
	//  * @since   1.0.0
	//  * @access  public
	//  */
	// public function header_widgets_show( $active, $section ) {
	// 	if ( strpos( $section->id, 'widgets-header-' ) ) {
	// 		$active = true;
	// 	}

	// 	return $active;
	// }

	/**
	 * Change section name based on the child section.
	 *
	 * @param WP_Customize_Manager $wp_customize Customizer object.
	 *
	 * @return WP_Customize_Manager Customizer object.
	 */
	public function customize_register( WP_Customize_Manager $wp_customize ) {
		parent::customize_register( $wp_customize );
		$wp_customize->get_section( $this->section )->panel = $this->panel;

		return $wp_customize;
	}

	/**
	 * Generic settings, if any.
	 */
	public function add_settings() {

	}

	/**
	 * The render method.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function render_component() {
		Main::get_instance()->load( 'components/component-header-sidebar' );
	}
}
