/**
 * Hook in and add a layout metabox. Can only happen on the 'cmb2_init' hook.
 */
function inti_register_layout_metabox()
{
    // Start with an underscore to hide fields from custom fields list
    $prefix = '_inti_layout_';
    $cmb_layout = new_cmb2_box(array('id' => $prefix . 'metabox', 'title' => __('Configuration', 'inti'), 'object_types' => array('page', 'post'), 'context' => 'side', 'priority' => 'core'));
    $cmb_layout->add_field(array('name' => __('Page Layout', 'inti'), 'desc' => __('Decide whether to show or hide a sidebar and where to place it.', 'inti'), 'id' => $prefix . 'radio', 'type' => 'radio', 'default' => 'default', 'options' => inti_get_theme_layouts(true)));
    $cmb_layout->add_field(array('name' => __('Sticky Sidebar', 'inti'), 'desc' => __('Keep sidebar widgets in view as you scroll down the page.', 'inti'), 'id' => $prefix . 'stickysidebars', 'type' => 'radio', 'default' => 'default', 'options' => array('default' => __('As Set In Customize', 'inti'), 'static' => __('Static', 'inti'), 'sticky' => __('Sticky', 'inti'))));
}
 $wp_customize->add_setting('inti_customizer_options[nav_logo_image]', array('default' => '', 'type' => 'option', 'capability' => 'manage_options'));
 $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'inti_nav_logo_image', array('label' => __('Site Logo for Mobile Nav', 'inti'), 'section' => 'inti_customizer_general', 'settings' => 'inti_customizer_options[nav_logo_image]', 'priority' => 6)));
 $wp_customize->add_setting('inti_customizer_options[show_nav_logo_title]', array('default' => 1, 'type' => 'option', 'capability' => 'manage_options', 'transport' => 'postMessage'));
 $wp_customize->add_control('inti_customizer_options[show_nav_logo_title]', array('label' => __('Show Logo/Title in Mobile Nav', 'inti'), 'section' => 'inti_customizer_general', 'type' => 'select', 'choices' => array('none' => __('Nothing', 'inti'), 'image' => __('Image/Logo', 'inti'), 'title' => __('Site Title', 'inti')), 'priority' => 7));
 $wp_customize->add_setting('inti_customizer_options[favicon_image]', array('default' => '', 'type' => 'option', 'capability' => 'manage_options'));
 $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'inti_favicon_image', array('label' => __('Favicon', 'inti'), 'section' => 'inti_customizer_general', 'settings' => 'inti_customizer_options[favicon_image]', 'priority' => 8)));
 $wp_customize->add_setting('inti_customizer_options[apple_touch_icon]', array('default' => '', 'type' => 'option', 'capability' => 'manage_options'));
 $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'inti_apple_touch_icon', array('label' => __('Apple Touch Icon', 'inti'), 'section' => 'inti_customizer_general', 'settings' => 'inti_customizer_options[apple_touch_icon]', 'priority' => 9)));
 $wp_customize->add_setting('inti_customizer_options[ms_tile_color]', array('default' => '', 'type' => 'option', 'capability' => 'manage_options'));
 $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'inti_ms_tile_color', array('label' => __('Windows Tile Color', 'inti'), 'section' => 'inti_customizer_general', 'settings' => 'inti_customizer_options[ms_tile_color]', 'priority' => 10)));
 $wp_customize->add_setting('inti_customizer_options[ms_tile_image]', array('default' => '', 'type' => 'option', 'capability' => 'manage_options'));
 $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'inti_ms_tile_image', array('label' => __('Windows Tile Image', 'inti'), 'section' => 'inti_customizer_general', 'settings' => 'inti_customizer_options[ms_tile_image]', 'priority' => 11)));
 $wp_customize->add_setting('inti_customizer_options[theme_color]', array('default' => '', 'type' => 'option', 'capability' => 'manage_options'));
 $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'inti_theme_color', array('label' => __('Theme Color', 'inti'), 'section' => 'inti_customizer_general', 'settings' => 'inti_customizer_options[theme_color]', 'priority' => 12)));
 // Posts & Pages
 $theme_layouts = inti_get_theme_layouts(false);
 $wp_customize->add_section('inti_customizer_posts', array('title' => __('Page Options', 'inti'), 'priority' => 20));
 $wp_customize->add_setting('inti_customizer_options[site_layout]', array('default' => '2c-l', 'type' => 'option', 'capability' => 'manage_options'));
 $wp_customize->add_control('inti_customizer_options[site_layout]', array('label' => __('Default Layout', 'inti'), 'description' => __('Default layout for all pages, posts, archives and custom types throughout the site if not individually changed or overwritten below', 'inti'), 'section' => 'inti_customizer_posts', 'type' => 'select', 'choices' => $theme_layouts, 'priority' => 4));
 $wp_customize->add_setting('inti_customizer_options[page_layout]', array('default' => '2c-l', 'type' => 'option', 'capability' => 'manage_options'));
 $wp_customize->add_control('inti_customizer_options[page_layout]', array('label' => __('Page Layout', 'inti'), 'description' => __('Default layout for static pages', 'inti'), 'section' => 'inti_customizer_posts', 'type' => 'select', 'choices' => $theme_layouts, 'priority' => 5));
 $wp_customize->add_setting('inti_customizer_options[post_layout]', array('default' => '2c-l', 'type' => 'option', 'capability' => 'manage_options'));
 $wp_customize->add_control('inti_customizer_options[post_layout]', array('label' => __('Single Post Layout', 'inti'), 'description' => __('Default layout for blog posts', 'inti'), 'section' => 'inti_customizer_posts', 'type' => 'select', 'choices' => $theme_layouts, 'priority' => 6));
 $wp_customize->add_setting('inti_customizer_options[archive_layout]', array('default' => '2c-l', 'type' => 'option', 'capability' => 'manage_options'));
 $wp_customize->add_control('inti_customizer_options[archive_layout]', array('label' => __('Post Archive Layout', 'inti'), 'description' => __('Default layout for blog post archives and index', 'inti'), 'section' => 'inti_customizer_posts', 'type' => 'select', 'choices' => $theme_layouts, 'priority' => 6));
 $wp_customize->add_setting('inti_customizer_options[sticky_sidebars]', array('default' => 'static', 'type' => 'option', 'capability' => 'manage_options', 'theme_supports' => 'inti-sticky-sidebars'));
 $wp_customize->add_control('inti_customizer_options[sticky_sidebars]', array('label' => __('Sticky Sidebars', 'inti'), 'description' => __('Keep sidebar widgets in view as you scroll down the page.', 'inti'), 'section' => 'inti_customizer_posts', 'type' => 'select', 'choices' => array('static' => __('Static', 'inti'), 'sticky' => __('Sticky', 'inti')), 'priority' => 7));
 // Fonts
 $font_faces = array_merge(inti_get_typography_os_fonts(), inti_get_typography_google_fonts());
 $font_sizes = inti_get_typography_font_sizes();
 $wp_customize->add_section('inti_customizer_main_styles', array('title' => __('Main Styles', 'inti'), 'priority' => 30, 'theme_supports' => 'inti-fonts'));