<?php

/**
 * Active Callbacks
 *
 * @package Macro News
 */

// Theme Options.
function macro_news_is_breadcrumb_enabled( $control ) {
	return ( $control->manager->get_setting( 'macro_news_enable_breadcrumb' )->value() );
}

// Flash News Section.
function macro_news_is_flash_news_section_enabled( $control ) {
	return ( $control->manager->get_setting( 'macro_news_enable_flash_news_section' )->value() );
}
function macro_news_is_flash_news_section_and_content_type_post_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_flash_news_content_type' )->value();
	return ( macro_news_is_flash_news_section_enabled( $control ) && ( 'post' === $content_type ) );
}
function macro_news_is_flash_news_section_and_content_type_category_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_flash_news_content_type' )->value();
	return ( macro_news_is_flash_news_section_enabled( $control ) && ( 'category' === $content_type ) );
}

// Banner Section.
function macro_news_is_banner_section_enabled( $control ) {
	return ( $control->manager->get_setting( 'macro_news_enable_banner_section' )->value() );
}
// Banner Section - Main News.
function macro_news_is_banner_section_and_content_type_post_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_main_news_content_type' )->value();
	return ( macro_news_is_banner_section_enabled( $control ) && ( 'post' === $content_type ) );
}
function macro_news_is_banner_section_and_content_type_category_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_main_news_content_type' )->value();
	return ( macro_news_is_banner_section_enabled( $control ) && ( 'category' === $content_type ) );
}
// Banner Section - Editor Pick.
function macro_news_is_editor_pick_section_and_content_type_post_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_editor_pick_content_type' )->value();
	return ( macro_news_is_banner_section_enabled( $control ) && ( 'post' === $content_type ) );
}
function macro_news_is_editor_pick_section_and_content_type_category_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_editor_pick_content_type' )->value();
	return ( macro_news_is_banner_section_enabled( $control ) && ( 'category' === $content_type ) );
}
// Banner Section - Trending Posts.
function macro_news_is_trending_posts_section_and_content_type_post_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_trending_posts_content_type' )->value();
	return ( macro_news_is_banner_section_enabled( $control ) && ( 'post' === $content_type ) );
}
function macro_news_is_trending_posts_section_and_content_type_category_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_trending_posts_content_type' )->value();
	return ( macro_news_is_banner_section_enabled( $control ) && ( 'category' === $content_type ) );
}

// Todays Pick Section.
function macro_news_is_todays_pick_section_enabled( $control ) {
	return ( $control->manager->get_setting( 'macro_news_enable_todays_pick_section' )->value() );
}
function macro_news_is_todays_pick_section_and_content_type_post_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_todays_pick_content_type' )->value();
	return ( macro_news_is_todays_pick_section_enabled( $control ) && ( 'post' === $content_type ) );
}
function macro_news_is_todays_pick_section_and_content_type_category_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_todays_pick_content_type' )->value();
	return ( macro_news_is_todays_pick_section_enabled( $control ) && ( 'category' === $content_type ) );
}
// Todays Pick - Most Recent Section
function macro_news_is_most_recent_section_and_content_type_post_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_most_recent_content_type' )->value();
	return ( macro_news_is_todays_pick_section_enabled( $control ) && ( 'post' === $content_type ) );
}
function macro_news_is_most_recent_section_and_content_type_category_enabled( $control ) {
	$content_type = $control->manager->get_setting( 'macro_news_most_recent_content_type' )->value();
	return ( macro_news_is_todays_pick_section_enabled( $control ) && ( 'category' === $content_type ) );
}

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