<?php
/*
 * All Metabox related options for Confin theme.
 * Author & Copyright:themexshaper
 * URL: http://themeforest.net/user/themexshaper
 */

function confin_metabox_options( $options ) {

 $cf7 = get_posts( 'post_type="wpcf7_contact_form"&numberposts=-1' );
    $contact_forms = array();
    if ( $cf7 ) {
      foreach ( $cf7 as $cform ) {
        $contact_forms[ $cform->ID ] = $cform->post_title;
      }
    } else {
      $contact_forms[ esc_html__( 'No contact forms found', 'confin' ) ] = 0;
    }
  $options      = array();

  // -----------------------------------------
  // Post Metabox Options                    -
  // -----------------------------------------
  $options[]    = array(
    'id'        => 'post_type_metabox',
    'title'     => esc_html__('Gallery Images', 'confin'),
    'post_type' => 'post',
    'context'   => 'side',
    'priority'  => 'default',
    'sections'  => array(

      // All Post Formats
      array(
        'name'   => 'section_post_formats',
        'fields' => array(

          array(
            'id'          => 'gallery_post_format',
            'type'        => 'gallery',
            'title'       => esc_html__('Add Gallery', 'confin'),
            'add_title'   => esc_html__('Add Image(s)', 'confin'),
            'edit_title'  => esc_html__('Edit Image(s)', 'confin'),
            'clear_title' => esc_html__('Clear Image(s)', 'confin'),
          ),
          array(
            'id'           => 'grid_image',
            'type'         => 'image',
            'title'        => esc_html__('Post Grid Image', 'confin'),
            'add_title' => esc_html__('Add Post Grid Image', 'confin'),
          ),
        ),
      ),

    ),
  );

  // -----------------------------------------
  // Page Metabox Options                    -
  // -----------------------------------------
  $header_search = cs_get_option( 'header_search' );
  $options[]    = array(
    'id'        => 'page_type_metabox',
    'title'     => esc_html__('Page Custom Options', 'confin'),
    'post_type' => array('post', 'page','service'),
    'context'   => 'normal',
    'priority'  => 'default',
    'sections'  => array(

      // Title Section
      array(
        'name'  => 'page_topbar_section',
        'title' => esc_html__('Top Bar', 'confin'),
        'icon'  => 'fa fa-minus',

        // Fields Start
        'fields' => array(

          array(
            'id'           => 'topbar_options',
            'type'         => 'image_select',
            'title'        => esc_html__('Topbar', 'confin'),
            'options'      => array(
              'default'     => CONFIN_CS_IMAGES .'/topbar-default.png',
              'custom'      => CONFIN_CS_IMAGES .'/topbar-custom.png',
              'hide_topbar' => CONFIN_CS_IMAGES .'/topbar-hide.png',
            ),
            'attributes' => array(
              'data-depend-id' => 'hide_topbar_select',
            ),
            'radio'     => true,
            'default'   => 'default',
          ),
          array(
            'id'          => 'top_left',
            'type'        => 'textarea',
            'title'       => esc_html__('Top Left', 'confin'),
            'dependency'  => array('hide_topbar_select', '==', 'custom'),
            'shortcode'       => true,
          ),
          array(
            'id'          => 'top_right',
            'type'        => 'textarea',
            'title'       => esc_html__('Top Right', 'confin'),
            'dependency'  => array('hide_topbar_select', '==', 'custom'),
            'shortcode'       => true,
          ),
          array(
            'id'    => 'topbar_bg',
            'type'  => 'color_picker',
            'title' => esc_html__('Topbar Background Color', 'confin'),
            'dependency'  => array('hide_topbar_select', '==', 'custom'),
          ),
          array(
            'id'    => 'topbar_border',
            'type'  => 'color_picker',
            'title' => esc_html__('Topbar Border Color', 'confin'),
            'dependency'  => array('hide_topbar_select', '==', 'custom'),
          ),

        ), // End : Fields

      ), // Title Section

      // Header
      array(
        'name'  => 'header_section',
        'title' => esc_html__('Header', 'confin'),
        'icon'  => 'fa fa-bars',
        'fields' => array(

          array(
            'id'           => 'select_header_design',
            'type'         => 'image_select',
            'title'        => esc_html__('Select Header Design', 'confin'),
            'options'      => array(
              'default'    => CONFIN_CS_IMAGES .'/hs-0.png',
              'style_one'    => CONFIN_CS_IMAGES .'/hs-1.png',
              'style_two'    => CONFIN_CS_IMAGES .'/hs-2.png',
            ),
            'attributes' => array(
              'data-depend-id' => 'header_design',
            ),
            'radio'        => true,
            'default'   => 'style_one',
            'info' => esc_html__('Select your header design, following options will may differ based on your selection of header design.', 'confin'),
          ),
          array(
            'id'    => 'transparency_header',
            'type'  => 'switcher',
            'title' => esc_html__('Transparent Header', 'confin'),
            'info' => esc_html__('Use Transparent Method', 'confin'),
          ),
          array(
            'id'    => 'transparent_menu_color',
            'type'  => 'color_picker',
            'title' => esc_html__('Menu Color', 'confin'),
            'info' => esc_html__('Pick your menu color. This color will only apply for non-sticky header mode.', 'confin'),
            'dependency'   => array('transparency_header', '==', 'true'),
          ),
          array(
            'id'    => 'transparent_menu_hover_color',
            'type'  => 'color_picker',
            'title' => esc_html__('Menu Hover Color', 'confin'),
            'info' => esc_html__('Pick your menu hover color. This color will only apply for non-sticky header mode.', 'confin'),
            'dependency'   => array('transparency_header', '==', 'true'),
          ),
          array(
            'id'             => 'choose_menu',
            'type'           => 'select',
            'title'          => esc_html__('Choose Menu', 'confin'),
            'desc'          => esc_html__('Choose custom menus for this page.', 'confin'),
            'options'        => 'menus',
            'default_option' => esc_html__('Select your menu', 'confin'),
          ),

          // Enable & Disable
          array(
            'type'    => 'notice',
            'class'   => 'info cs-confin-heading',
            'content' => esc_html__('Enable & Disable', 'confin'),
            'dependency' => array('header_design', '!=', 'default'),
          ),
          array(
            'id'    => 'sticky_header',
            'type'  => 'switcher',
            'title' => esc_html__('Sticky Header', 'confin'),
            'info' => esc_html__('Turn On if you want your naviagtion bar on sticky.', 'confin'),
            'default' => true,
            'dependency' => array('header_design', '!=', 'default'),
          ),
        ),
      ),
      // Header

      // Banner & Title Area
      array(
        'name'  => 'banner_title_section',
        'title' => esc_html__('Banner & Title Area', 'confin'),
        'icon'  => 'fa fa-bullhorn',
        'fields' => array(

          array(
            'id'        => 'banner_type',
            'type'      => 'select',
            'title'     => esc_html__('Choose Banner Type', 'confin'),
            'options'   => array(
              'default-title'    => 'Default Title',
              'revolution-slider' => 'Shortcode [Rev Slider]',
              'hide-title-area'   => 'Hide Title/Banner Area',
            ),
          ),
          array(
            'id'    => 'page_revslider',
            'type'  => 'textarea',
            'title' => esc_html__('Revolution Slider or Any Shortcodes', 'confin'),
            'desc' => __('Enter any shortcodes that you want to show in this page title area. <br />Eg : Revolution Slider shortcode.', 'confin'),
            'attributes' => array(
              'placeholder' => esc_html__('Enter your shortcode...', 'confin'),
            ),
            'dependency'   => array('banner_type', '==', 'revolution-slider'),
          ),
          array(
            'id'    => 'page_custom_title',
            'type'  => 'text',
            'title' => esc_html__('Custom Title', 'confin'),
            'attributes' => array(
              'placeholder' => esc_html__('Enter your custom title...', 'confin'),
            ),
            'dependency'   => array('banner_type', '==', 'default-title'),
          ),
          array(
            'id'        => 'title_area_spacings',
            'type'      => 'select',
            'title'     => esc_html__('Title Area Spacings', 'confin'),
            'options'   => array(
              'padding-default' => esc_html__('Default Spacing', 'confin'),
              'padding-custom' => esc_html__('Custom Padding', 'confin'),
            ),
            'dependency'   => array('banner_type', '==', 'default-title'),
          ),
          array(
            'id'    => 'title_top_spacings',
            'type'  => 'text',
            'title' => esc_html__('Top Spacing', 'confin'),
            'attributes'  => array( 'placeholder' => '100px' ),
            'dependency'  => array('banner_type|title_area_spacings', '==|==', 'default-title|padding-custom'),
          ),
          array(
            'id'    => 'title_bottom_spacings',
            'type'  => 'text',
            'title' => esc_html__('Bottom Spacing', 'confin'),
            'attributes'  => array( 'placeholder' => '100px' ),
            'dependency'  => array('banner_type|title_area_spacings', '==|==', 'default-title|padding-custom'),
          ),
          array(
            'id'    => 'title_area_bg',
            'type'  => 'background',
            'title' => esc_html__('Background', 'confin'),
            'dependency'   => array('banner_type', '==', 'default-title'),
          ),
          array(
            'id'    => 'titlebar_bg_overlay_color',
            'type'  => 'color_picker',
            'title' => esc_html__('Overlay Color', 'confin'),
            'dependency'   => array('banner_type', '==', 'default-title'),
          ),
          array(
            'id'    => 'title_color',
            'type'  => 'color_picker',
            'title' => esc_html__('Title Color', 'confin'),
            'dependency'   => array('banner_type', '==', 'default-title'),
          ),

        ),
      ),
      // Banner & Title Area

      // Content Section
      array(
        'name'  => 'page_content_options',
        'title' => esc_html__('Content Options', 'confin'),
        'icon'  => 'fa fa-file',

        'fields' => array(

          array(
            'id'        => 'content_spacings',
            'type'      => 'select',
            'title'     => esc_html__('Content Spacings', 'confin'),
            'options'   => array(
              'padding-default' => esc_html__('Default Spacing', 'confin'),
              'padding-custom' => esc_html__('Custom Padding', 'confin'),
            ),
            'desc' => esc_html__('Content area top and bottom spacings.', 'confin'),
          ),
          array(
            'id'    => 'content_top_spacings',
            'type'  => 'text',
            'title' => esc_html__('Top Spacing', 'confin'),
            'attributes'  => array( 'placeholder' => '100px' ),
            'dependency'  => array('content_spacings', '==', 'padding-custom'),
          ),
          array(
            'id'    => 'content_bottom_spacings',
            'type'  => 'text',
            'title' => esc_html__('Bottom Spacing', 'confin'),
            'attributes'  => array( 'placeholder' => '100px' ),
            'dependency'  => array('content_spacings', '==', 'padding-custom'),
          ),
        ), // End Fields
      ), // Content Section

      // Enable & Disable
      array(
        'name'  => 'hide_show_section',
        'title' => esc_html__('Enable & Disable', 'confin'),
        'icon'  => 'fa fa-toggle-on',
        'fields' => array(
          array(
            'id'    => 'header_search',
            'type'  => 'switcher',
            'title' => esc_html__('Header Search', 'confin'),
            'info' => esc_html__('Turn On if you want to hide Header Search .', 'confin'),
            'default' => $header_search,
          ),
          array(
            'id'    => 'hide_header',
            'type'  => 'switcher',
            'title' => esc_html__('Hide Header', 'confin'),
            'label' => esc_html__('Yes, Please do it.', 'confin'),
          ),
          array(
            'id'    => 'hide_breadcrumbs',
            'type'  => 'switcher',
            'title' => esc_html__('Hide Breadcrumbs', 'confin'),
            'label' => esc_html__('Yes, Please do it.', 'confin'),
          ),
          array(
            'id'    => 'hide_footer',
            'type'  => 'switcher',
            'title' => esc_html__('Hide Footer', 'confin'),
            'label' => esc_html__('Yes, Please do it.', 'confin'),
          ),
          array(
            'id'    => 'box_style_page',
            'type'  => 'switcher',
            'title' => esc_html__('Box Style', 'confin'),
            'label' => esc_html__('Yes, Please do it.', 'confin'),
          ),

        ),
      ),
      // Enable & Disable

    ),
  );

  // -----------------------------------------
  // Page Layout
  // -----------------------------------------
  $options[]    = array(
    'id'        => 'page_layout_options',
    'title'     => esc_html__('Page Layout', 'confin'),
    'post_type' => 'page',
    'context'   => 'side',
    'priority'  => 'default',
    'sections'  => array(

      array(
        'name'   => 'page_layout_section',
        'fields' => array(

          array(
            'id'        => 'page_layout',
            'type'      => 'image_select',
            'options'   => array(
              'full-width'    => CONFIN_CS_IMAGES . '/page-1.png',
              'extra-width'   => CONFIN_CS_IMAGES . '/page-2.png',
              'left-sidebar'  => CONFIN_CS_IMAGES . '/page-3.png',
              'right-sidebar' => CONFIN_CS_IMAGES . '/page-4.png',
            ),
            'attributes' => array(
              'data-depend-id' => 'page_layout',
            ),
            'default'    => 'full-width',
            'radio'      => true,
            'wrap_class' => 'text-center',
          ),
          array(
            'id'            => 'page_sidebar_widget',
            'type'           => 'select',
            'title'          => esc_html__('Sidebar Widget', 'confin'),
            'options'        => confin_registered_sidebars(),
            'default_option' => esc_html__('Select Widget', 'confin'),
            'dependency'   => array('page_layout', 'any', 'left-sidebar,right-sidebar'),
          ),

        ),
      ),

    ),
  );


  // -----------------------------------------
  // Testimonial
  // -----------------------------------------
  $options[]    = array(
    'id'        => 'testimonial_options',
    'title'     => esc_html__('Testimonial Client', 'confin'),
    'post_type' => 'testimonial',
    'context'   => 'side',
    'priority'  => 'default',
    'sections'  => array(

      array(
        'name'   => 'testimonial_option_section',
        'fields' => array(

          array(
            'id'      => 'testi_name',
            'type'    => 'text',
            'title'   => esc_html__('Name', 'confin'),
            'info'    => esc_html__('Enter client name', 'confin'),
          ),
          array(
            'id'      => 'testi_name_link',
            'type'    => 'text',
            'title'   => esc_html__('Name Link', 'confin'),
            'info'    => esc_html__('Enter client name link, if you want', 'confin'),
          ),
          array(
            'id'      => 'testi_pro',
            'type'    => 'text',
            'title'   => esc_html__('Profession', 'confin'),
            'info'    => esc_html__('Enter client profession', 'confin'),
          ),
          array(
            'id'      => 'testi_pro_link',
            'type'    => 'text',
            'title'   => esc_html__('Profession Link', 'confin'),
            'info'    => esc_html__('Enter client profession link', 'confin'),
          ),

        ),
      ),

    ),
  );

 // -----------------------------------------
  // Service
  // -----------------------------------------
  $options[]    = array(
    'id'        => 'service_options',
    'title'     => esc_html__('Service Extra Options', 'confin'),
    'post_type' => 'service',
    'context'   => 'side',
    'priority'  => 'default',
    'sections'  => array(

      array(
        'name'   => 'service_option_section',
        'fields' => array(
         array(
            'id'    => 'service_title',
            'type'  => 'text',
            'title' => esc_html__('Service Title', 'confin'),
            'info'    => esc_html__('Enter Service Title for Service Item.', 'confin'),
          ),
         array(
            'id'    => 'short_desc',
            'type'  => 'textarea',
            'title' => esc_html__('Short Description', 'confin'),
            'info'    => esc_html__('Enter shotn description as excerpt.', 'confin'),
          ),
         array(
            'id'    => 'service_excerpt',
            'type'  => 'textarea',
            'title' => esc_html__('Service Excerpt', 'confin'),
            'info'    => esc_html__('Enter shotn description as excerpt.', 'confin'),
          ),
          array(
            'id'           => 'service_image',
            'type'         => 'image',
            'title'        => esc_html__('Service Image', 'confin'),
            'add_title' => esc_html__('Add Service Image', 'confin'),
          ),
          array(
            'id'                  => 'service_tabs',
            'type'                => 'group',
            'title'           => esc_html__('Service Tabs', 'confin'),
            'fields'              => array(
              array(
                'id'              => 'tab_title',
                'type'            => 'text',
                'title'           => esc_html__('Info Title', 'confin'),
              ),
              array(
                'id'              => 'service_desc',
                'type'            => 'textarea',
                'title'           => esc_html__('Info Description', 'confin'),
                'shortcode'       => true,
              ),
            ),
            'button_title'        => esc_html__('Add Service Tab', 'confin'),
            'accordion_title'     => esc_html__('Service Tab', 'confin'),
          ),
         array(
            'id'    => 'button_text',
            'type'  => 'text',
            'title' => esc_html__('Service Button Text', 'confin'),
          ),
         array(
            'id'    => 'button_url',
            'type'  => 'text',
            'title' => esc_html__('Service Button URL', 'confin'),
          ),
        ),
      ),

    ),
  );


  // -----------------------------------------
  // Project Metabox Options                    -
  // -----------------------------------------

  $options[]    = array(
    'id'        => 'page_details_metabox',
    'title'     => esc_html__('Project Details Options', 'confin'),
    'post_type' => array('project'),
    'context'   => 'normal',
    'priority'  => 'default',
    'sections'  => array(

      // Title Section
      array(
        'name'  => 'project_challenges_section',
        'title' => esc_html__('Challenges', 'confin'),
        'icon'  => 'fa fa-minus',

        // Fields Start
        'fields' => array(
          array(
            'id'          => 'challenges_title',
            'type'        => 'text',
            'title'       => esc_html__('Title', 'confin'),
          ),
          array(
            'id'          => 'challenges_description',
            'type'        => 'textarea',
            'title'       => esc_html__('Description', 'confin'),
            'shortcode'       => true,
          ),
          array(
            'id'                  => 'chalanges',
            'type'                => 'group',
            'title'           => esc_html__('Chalanges', 'confin'),
            'fields'              => array(
              array(
                'id'              => 'title',
                'type'            => 'text',
                'title'           => esc_html__('Title', 'confin'),
              ),
            ),
            'button_title'        => esc_html__('Add Chalanges', 'confin'),
            'accordion_title'     => esc_html__('Chalanges', 'confin'),
          ),
        ), // End : Fields

      ), // Title Section

      // Title Section
      array(
        'name'  => 'project_solutions_section',
        'title' => esc_html__('Solutions', 'confin'),
        'icon'  => 'fa fa-minus',

        // Fields Start
        'fields' => array(
          array(
            'id'          => 'solutions_title',
            'type'        => 'text',
            'title'       => esc_html__('Title', 'confin'),
          ),
          array(
            'id'          => 'solutions_description',
            'type'        => 'textarea',
            'title'       => esc_html__('Solutions', 'confin'),
            'shortcode'       => true,
          ),
          array(
            'id'                  => 'solutions',
            'type'                => 'group',
            'title'           => esc_html__('Solution', 'confin'),
            'fields'              => array(
              array(
                'id'              => 'title',
                'type'            => 'text',
                'title'           => esc_html__('Title', 'confin'),
              ),
            ),
            'button_title'        => esc_html__('Add Solution', 'confin'),
            'accordion_title'     => esc_html__('Solution', 'confin'),
          ),
        ), // End : Fields

      ), // Title Section

    ),
  );

  // -----------------------------------------
  // Project
  // -----------------------------------------
  $options[]    = array(
    'id'        => 'project_options',
    'title'     => esc_html__('Project Extra Options', 'confin'),
    'post_type' => 'project',
    'context'   => 'side',
    'priority'  => 'default',
    'sections'  => array(

      array(
        'name'   => 'project_option_section',
        'fields' => array(

          array(
            'id'      => 'project_subtitle',
            'type'    => 'text',
            'attributes' => array(
              'placeholder' => esc_html__('Project : Sub Title', 'confin'),
            ),
            'info'    => esc_html__('Write Project Sub Title.', 'confin'),
          ),
          array(
            'id'           => 'project_title',
            'type'         => 'text',
            'title'        => esc_html__('Info title', 'confin'),
            'add_title' => esc_html__('Add Info title', 'confin'),
            'attributes' => array(
              'placeholder' => esc_html__('Info Title', 'confin'),
            ),
            'info'    => esc_html__('Write Info Title.', 'confin'),
          ),
           // Start fields
          array(
            'id'                  => 'project_infos',
            'type'                => 'group',
            'fields'              => array(
              array(
                'id'              => 'project_title',
                'type'            => 'text',
                'title'           => esc_html__('Info Title', 'confin'),
              ),
              array(
                'id'              => 'project_desc',
                'type'            => 'text',
                'title'           => esc_html__('Info Description', 'confin'),
              ),
            ),
            'button_title'        => esc_html__('Add Project info', 'confin'),
            'accordion_title'     => esc_html__('project Info', 'confin'),
          ),
          array(
            'id'           => 'project_image',
            'type'         => 'image',
            'title'        => esc_html__('Project Grid Image', 'confin'),
            'add_title' => esc_html__('Add Project Grid Image', 'confin'),
          ),
        ),
      ),

    ),
  );


  return $options;

}
add_filter( 'cs_metabox_options', 'confin_metabox_options' );