<?php
/**
 * Active callback functions.
 *
 * @package Prime Charity Trust
 */

function prime_charity_trust_featured_slider_active( $control ) {
    if( $control->manager->get_setting( 'theme_options[enable_featured_slider_section]' )->value() == true ) {
        return true;
    }else{
        return false;
    }
}

function prime_charity_trust_featured_slider_page( $control ) {
    $prime_charity_trust_content_type = $control->manager->get_setting( 'theme_options[featured_slider_content_type]' )->value();
    return ( prime_charity_trust_featured_slider_active( $control ) && ( 'featured_slider_page' == $prime_charity_trust_content_type ) );
}

function prime_charity_trust_featured_slider_post( $control ) {
    $prime_charity_trust_content_type = $control->manager->get_setting( 'theme_options[featured_slider_content_type]' )->value();
    return ( prime_charity_trust_featured_slider_active( $control ) && ( 'featured_slider_post' == $prime_charity_trust_content_type ) );
}

function prime_charity_trust_featured_services_active( $control ) {
    if( $control->manager->get_setting( 'theme_options[enable_featured_services_section]' )->value() == true ) {
        return true;
    }else{
        return false;
    }
}

/**
 * Active Callback for top bar section
 */
function prime_charity_trust_contact_info_ac( $control ) {

    $prime_charity_trust_show_contact_info = $control->manager->get_setting( 'theme_options[show_header_contact_info]')->value();
    $prime_charity_trust_control_id        = $control->id;
         
    if ( $prime_charity_trust_control_id == 'theme_options[header_location]' && $prime_charity_trust_show_contact_info ) return true;
    if ( $prime_charity_trust_control_id == 'theme_options[header_email]' && $prime_charity_trust_show_contact_info ) return true;
    if ( $prime_charity_trust_control_id == 'theme_options[header_phone]' && $prime_charity_trust_show_contact_info ) return true;
    if ( $prime_charity_trust_control_id == 'theme_options[header_donate_btn_text]' && $prime_charity_trust_show_contact_info ) return true;
    if ( $prime_charity_trust_control_id == 'theme_options[header_donate_btn_url]' && $prime_charity_trust_show_contact_info ) return true;

    return false;
}

function prime_charity_trust_social_links_active( $control ) {
    if( $control->manager->get_setting( 'theme_options[show_header_social_links]' )->value() == true ) {
        return true;
    }else{
        return false;
    }
}