<?php
/**
 * Include and setup custom metaboxes and fields. (make sure you copy this file to outside the CMB2 directory)
 *
 * Be sure to replace all instances of 'yourprefix_' with your project's prefix.
 * http://nacin.com/2010/05/11/in-wordpress-prefix-everything/
 *
 * @category YourThemeOrPlugin
 * @package  Demo_CMB2
 * @license  http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
 * @link     https://github.com/WebDevStudios/CMB2
 */

add_action( 'cmb2_init', 'helium_metaboxes_default' );
function helium_metaboxes_default() {

    // Start with an underscore to hide fields from custom fields list
    $prefix = 'helium_met_';

    

    
    /* Page Settings ***************************************************************************/
    /* ************************************************************************************/
    $cmb = new_cmb2_box( array(
        'id'            => 'page_heading_settings',
        'title'         => esc_html__( 'Show Page Heading', 'helium' ),
        'object_types'  => array( 'page'), // Post type
        'context'       => 'normal',
        'priority'      => 'high',
        'show_names'    => true,
        
    ) );

    // Display title of page
    $cmb->add_field( array(
        'name'       => esc_html__( 'Show title of page', 'helium' ),
        'desc'       => esc_html__( 'Allow display title of page', 'helium' ),
        'id'         => $prefix . 'page_heading',
        'type'             => 'select',
        'show_option_none' => false,
        'options'          => array(
            'yes' => esc_html__( 'Yes', 'helium' ),
            'no'   => esc_html__('No', 'helium' )
        ),
        'default' => 'yes',
        
    ) );


 
   

    
    /* Post Settings *********************************************************************************/
    /* *******************************************************************************/
    $cmb = new_cmb2_box( array(
        'id'            => 'post_video',
        'title'         => esc_html__( 'Post Settings', 'helium' ),
        'object_types'  => array( 'post'), // Post type
        'context'       => 'normal',
        'priority'      => 'high',
        'show_names'    => true, // Show field names on the left
    ));

        // Video or Audio
        $cmb->add_field( array(
            'name'       => esc_html__( 'Link audio or video', 'helium' ),
            'desc'       => esc_html__( 'Insert link audio or video use for video/audio post-format', 'helium' ),
            'id'         => $prefix . 'embed_media',
            'type'             => 'oembed',
        ) );


        // Gallery image
        $cmb->add_field( array(
            'name'       => esc_html__( 'Gallery image', 'helium' ),
            'desc'       => esc_html__( 'image in gallery post format', 'helium' ),
            'id'         => $prefix . 'file_list',
            'type'             => 'file_list',
        ) );
        // Cover image
        $cmb->add_field( array(
            'name'       => esc_html__( 'Cover Post Image', 'helium' ),
            'desc'       => esc_html__( 'image Cover in  post format', 'helium' ),
            'id'         => $prefix . 'image_cover',
            'type'             => 'file',
        ) );



    /* General Settings ***************************************************************/
    /* ********************************************************************************/
    $cmb = new_cmb2_box( array(
        'id'            => 'layout_settings',
        'title'         => esc_html__( 'General Settings', 'helium' ),
        'object_types'  => array( 'page', 'post'), // Post type
        'context'       => 'normal',
        'priority'      => 'high',
        'show_names'    => true, // Show field names on the left
    ));

        $cmb->add_field( array(
            'name'       => esc_html__( 'Header Version', 'helium' ),
            'id'         => $prefix . 'header_version',
            'description' => esc_html__( 'This value will override value in customizer', 'helium' ),
            'type'             => 'select',
            'show_option_none' => false,
            'options'          => helium_load_header_metabox(),
            'default' => 'global'
            
        ));

        $cmb->add_field( array(
            'name'       => esc_html__( 'Footer Version', 'helium' ),
            'id'         => $prefix . 'footer_version',
            'description' => esc_html__( 'This value will override value in customizer', 'helium'  ),
            'type'             => 'select',
            'show_option_none' => false,
            'options'          => helium_load_footer_metabox(),
            'default' => 'global'

        ) );

        $cmb->add_field( array(
            'name'       => esc_html__( 'Main Layout', 'helium' ),
            'desc'       => esc_html__( 'This value will override value in theme customizer', 'helium' ),
            'id'         => $prefix.'main_layout',
            'type'             => 'select',
            'show_option_none' => false,
            'options'          => array(
                'global'   => esc_html__('Global in customizer', 'helium' ),
                'right_sidebar' => esc_html__( 'Right Sidebar', 'helium' ),
                'left_sidebar'   => esc_html__('Left Sidebar', 'helium' ),
                'no_sidebar'   => esc_html__('No Sidebar', 'helium' ),
                'full_width'   => esc_html__('Full Width', 'helium' ),
            ),
            'default' => 'global',
            
        ) );


        $cmb->add_field( array(
            'name'       => esc_html__( 'Width of site', 'helium' ),
            'desc'       => esc_html__( 'This value will override value in theme customizer', 'helium' ),
            'id'         => $prefix . 'width_site',
            'type'             => 'select',
            'show_option_none' => false,
            'options'          => array(
                'global'    => esc_html__('Global in customizer', 'helium'),
                'wide' => esc_html__( 'Wide', 'helium' ),
                'boxed'   => esc_html__('Boxed', 'helium' ),
            ),
            'default' => 'global',
            
        ) );

        // Check customizer use SEO of theme
        if(get_theme_mod('seo_option','yes') == 'yes'){
            // Seo keywords
            $cmb->add_field( array(
                'name'       => esc_html__( 'SEO Keywords', 'helium' ),
                'desc'       => esc_html__( '(optional). This value will override value in global seo keyword of theme customizer.', 'helium' ),
                'id'         => $prefix . 'seo_key',
                'type'       => 'text',
                
            ) );

            // Seo description
            $cmb->add_field( array(
                'name'       => esc_html__( 'SEO Description', 'helium' ),
                'desc'       => esc_html__( '(optional). This value will override value in global seo description of theme customizer.', 'helium' ),
                'id'         => $prefix . 'seo_desc',
                'type'       => 'textarea',
            ) );
        }

   
}

