<?php
/**
 * Portfolio
 *
 * @license  http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
 * @link     https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress
 */

add_filter( 'cmb_meta_boxes', 'cmb_portfolio_metaboxes' );
/**
 * Define the metabox and field configurations.
 *
 * @param  array $meta_boxes
 * @return array
 */
function cmb_portfolio_metaboxes( array $meta_boxes ) {

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

	$meta_boxes[] = array(
		'id'         => 'md-meta-box-portfolio',
		'title'      => __('Portfolio Detail Settings', 'framework'),
		'pages'      => array( 'portfolio', ), // Post type
		'context'    => 'normal',
		'priority'   => 'high',
		'show_names' => true, // Show field names on the left
		'fields'     => array(
		
			array(
				'name'    => __('Portfolio Type', 'framework'),
				'desc'    => __('Choose the type of portfolio you wish to display.', 'framework'),
				'id'      => $prefix . 'portfolio_type',
				'type'    => 'select',
				'options' => array(
					array( 'name' => __('Image', 'framework'), 'value' => 'image', ),
					array( 'name' => __('Video', 'framework'), 'value' => 'video', ),
					
				),
			),
			array(
				'name' => __('Portfolio Client', 'framework'),
				'desc' => '',
				'id'   => $prefix . 'portfolio_client',
				'type' => 'text',
			),
			
			array(
				'name' => __('Portfolio URL', 'framework'),
				'desc' => '',
				'id'   => $prefix . 'portfolio_url',
				'type' => 'text',
			)
		),
	);
	
	$meta_boxes[] = array(
		'id'         => 'md-meta-box-portfolio-video',
		'title'      => __('Video Settings', 'framework'),
		'pages'      => array( 'portfolio', ), // Post type
		'context'    => 'normal',
		'priority'   => 'high',
		'show_names' => true, // Show field names on the left
		'fields'     => array(
		
			array(
				'name'    => __('Portfolio Type', 'framework'),
				'desc'    => __('Choose the type of Video source.', 'framework'),
				'id'      => $prefix . 'video_type',
				'type'    => 'select',
				'options' => array(
					array( 'name' => __('Youtube', 'framework'), 'value' => 'Youtube', ),
					array( 'name' => __('Vimeo', 'framework'), 'value' => 'Vimeo', ),
					
				),
			),
			array(
				'name' => __('Video Embed ID', 'framework'),
				'desc' => __('<br>Paste the ID of the video is hosted on, such as Youtube and Vimeo. you want to show<br> 
E.g. http://www.youtube.com/watch?v=<strong style="color:#333;">tbPhf_KXNZI</strong><br>
http://vimeo.com/<strong style="color:#333;">6428069</strong>', 'framework'),
				'id'   => $prefix . 'portfolio_video_embed_code_id',
				'type' => 'text_medium',
			),
		),
	);
	// Add other metaboxes as needed

	return $meta_boxes;
}