<?php

/**
 * Active Callbacks
 *
 * @package Headline News
 */

// Theme Options.
function headline_news_is_pagination_enabled( $control ) {
	return ( $control->manager->get_setting( 'headline_news_enable_pagination' )->value() );
}
function headline_news_is_breadcrumb_enabled( $control ) {
	return ( $control->manager->get_setting( 'headline_news_enable_breadcrumb' )->value() );
}

// Topbar Section.
function headline_news_is_topbar_section_enabled( $control ) {
	return ( $control->manager->get_setting( 'headline_news_enable_topbar_section' )->value() );
}

// Flash News Section.
function headline_news_is_flash_news_section_enabled( $control ) {
	return ( $control->manager->get_setting( 'headline_news_enable_flash_news_section' )->value() );
}
function headline_news_is_flash_news_section_and_content_type_post_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'headline_news_flash_news_content_type' )->value();
	return ( headline_news_is_flash_news_section_enabled( $control ) && ( 'post' === $content_type ) );
}
function headline_news_is_flash_news_section_and_content_type_category_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'headline_news_flash_news_content_type' )->value();
	return ( headline_news_is_flash_news_section_enabled( $control ) && ( 'category' === $content_type ) );
}

// Banner Section.
function headline_news_is_banner_section_enabled( $control ) {
	return ( $control->manager->get_setting( 'headline_news_enable_banner_section' )->value() );
}

// Banner Section - Main Banner.
function headline_news_is_main_news_section_and_content_type_post_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'headline_news_main_news_content_type' )->value();
	return ( headline_news_is_banner_section_enabled( $control ) && ( 'post' === $content_type ) );
}
function headline_news_is_main_news_section_and_content_type_category_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'headline_news_main_news_content_type' )->value();
	return ( headline_news_is_banner_section_enabled( $control ) && ( 'category' === $content_type ) );
}
// Banner Section - Featured News.
function headline_news_is_featured_news_section_and_content_type_post_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'headline_news_featured_news_content_type' )->value();
	return ( headline_news_is_banner_section_enabled( $control ) && ( 'post' === $content_type ) );
}
function headline_news_is_featured_news_section_and_content_type_category_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'headline_news_featured_news_content_type' )->value();
	return ( headline_news_is_banner_section_enabled( $control ) && ( 'category' === $content_type ) );
}

// Posts Carousel Section.
function headline_news_is_posts_carousel_section_enabled( $control ) {
	return ( $control->manager->get_setting( 'headline_news_enable_posts_carousel_section' )->value() );
}
function headline_news_is_posts_carousel_section_and_content_type_post_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'headline_news_posts_carousel_content_type' )->value();
	return ( headline_news_is_posts_carousel_section_enabled( $control ) && ( 'post' === $content_type ) );
}
function headline_news_is_posts_carousel_section_and_content_type_category_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'headline_news_posts_carousel_content_type' )->value();
	return ( headline_news_is_posts_carousel_section_enabled( $control ) && ( 'category' === $content_type ) );
}

// Check if static home page is enabled.
function headline_news_is_static_homepage_enabled( $control ) {
	return ( 'page' === $control->manager->get_setting( 'show_on_front' )->value() );
}
