<?php

/* Options for CymolThemes Call To Action */

$h2_custom_heading = vc_map_integrate_shortcode( 'cmt-custom-heading', 'h2_', esc_attr__( 'Heading', 'duplexo' ),
	array(
		'exclude' => array(
			'source',
			'text',
			'css',
		),
	),
	array(
		'element' => 'use_custom_fonts_h2',
		'value'   => 'true',
	)
);

// This is needed to remove custom heading _tag and _align options.
if ( is_array( $h2_custom_heading ) && ! empty( $h2_custom_heading ) ) {
	foreach ( $h2_custom_heading as $key => $param ) {
		if ( is_array( $param ) && isset( $param['type'] ) && 'font_container' === $param['type'] ) {
			$h2_custom_heading[ $key ]['value'] = '';
			if ( isset( $param['settings'] ) && is_array( $param['settings'] ) && isset( $param['settings']['fields'] ) ) {
				$sub_key = array_search( 'tag', $param['settings']['fields'] );
				if ( false !== $sub_key ) {
					unset( $h2_custom_heading[ $key ]['settings']['fields'][ $sub_key ] );
				} elseif ( isset( $param['settings']['fields']['tag'] ) ) {
					unset( $h2_custom_heading[ $key ]['settings']['fields']['tag'] );
				}
				$sub_key = array_search( 'text_align', $param['settings']['fields'] );
				if ( false !== $sub_key ) {
					unset( $h2_custom_heading[ $key ]['settings']['fields'][ $sub_key ] );
				} elseif ( isset( $param['settings']['fields']['text_align'] ) ) {
					unset( $h2_custom_heading[ $key ]['settings']['fields']['text_align'] );
				}
			}
		}
	}
}
$h4_custom_heading = vc_map_integrate_shortcode( 'cmt-custom-heading', 'h4_', esc_attr__( 'Subheading', 'duplexo' ),
	array(
		'exclude' => array(
			'source',
			'text',
			'css',
		),
	),
	array(
		'element' => 'use_custom_fonts_h4',
		'value' => 'true',
	)
);

// This is needed to remove custom heading _tag and _align options.
if ( is_array( $h4_custom_heading ) && ! empty( $h4_custom_heading ) ) {
	foreach ( $h4_custom_heading as $key => $param ) {
		if ( is_array( $param ) && isset( $param['type'] ) && 'font_container' === $param['type'] ) {
			$h4_custom_heading[ $key ]['value'] = '';
			if ( isset( $param['settings'] ) && is_array( $param['settings'] ) && isset( $param['settings']['fields'] ) ) {
				$sub_key = array_search( 'tag', $param['settings']['fields'] );
				if ( false !== $sub_key ) {
					unset( $h4_custom_heading[ $key ]['settings']['fields'][ $sub_key ] );
				} elseif ( isset( $param['settings']['fields']['tag'] ) ) {
					unset( $h4_custom_heading[ $key ]['settings']['fields']['tag'] );
				}
				$sub_key = array_search( 'text_align', $param['settings']['fields'] );
				if ( false !== $sub_key ) {
					unset( $h4_custom_heading[ $key ]['settings']['fields'][ $sub_key ] );
				} elseif ( isset( $param['settings']['fields']['text_align'] ) ) {
					unset( $h4_custom_heading[ $key ]['settings']['fields']['text_align'] );
				}
			}
		}
	}
}
$params = array_merge(
	array(
		array(
			'type'             => 'textfield',
			'heading'          => esc_attr__( 'Heading', 'duplexo' ),
			'admin_label'      => true,
			'param_name'       => 'h2',
			'value'            => '',
			'description'      => esc_attr__( 'Enter text for heading line.', 'duplexo' ),
			'edit_field_class' => 'vc_col-sm-9 vc_column',
		),
		array(
			'type'             => 'checkbox',
			'heading'          => esc_attr__( 'Use custom font?', 'duplexo' ),
			'param_name'       => 'use_custom_fonts_h2',
			'description'      => esc_attr__( 'Enable Google fonts.', 'duplexo' ),
			'edit_field_class' => 'vc_col-sm-3 vc_column',
		),

	),
	$h2_custom_heading,
	array(
		array(
			'type'             => 'textfield',
			'heading'          => esc_attr__( 'Subheading', 'duplexo' ),
			'param_name'       => 'h4',
			'value'            => '',
			'description'      => esc_attr__( 'Enter text for subheading line.', 'duplexo' ),
			'edit_field_class' => 'vc_col-sm-9 vc_column',
		),
		array(
			'type'             => 'checkbox',
			'heading'          => esc_attr__( 'Use custom font?', 'duplexo' ),
			'param_name'       => 'use_custom_fonts_h4',
			'description'      => esc_attr__( 'Enable custom font option.', 'duplexo' ),
			'edit_field_class' => 'vc_col-sm-3 vc_column',
		),
	),
	$h4_custom_heading,
	array(
		array(
			'type'        => 'dropdown',
			'heading'     => esc_attr__( 'Text alignment', 'duplexo' ),
			'param_name'  => 'txt_align',
			'value'       => cymolthemes_getVcShared( 'text align' ), // default left
			'description' => esc_attr__( 'Select text alignment in "Call to Action" block.', 'duplexo' ),
		),
		array(
			'type'             => 'checkbox',
			'heading'          => esc_attr__( 'Reverse heading order', 'duplexo' ),
			'param_name'       => 'reverse_heading',
			'description'      => esc_attr__( 'Show sub-heading before heading.', 'duplexo' ),
		),
		array(
			'type'       => 'dropdown',
			'heading'    => esc_attr__( 'Shape', 'duplexo' ),
			'param_name' => 'shape',
			'std'        => 'rounded',
			'value'      => array(
				esc_attr__( 'Square', 'duplexo' )  => 'square',
				esc_attr__( 'Rounded', 'duplexo' ) => 'rounded',
				esc_attr__( 'Round', 'duplexo' )   => 'round',
			),
			'description' => esc_attr__( 'Select call to action shape.', 'duplexo' ),
		),
		array(
			'type'       => 'dropdown',
			'heading'    => esc_attr__( 'Style', 'duplexo' ),
			'param_name' => 'style',
			'value' => array(
				esc_attr__( 'Classic', 'duplexo' ) => 'classic',
				esc_attr__( 'Flat', 'duplexo' )    => 'flat',
				esc_attr__( 'Outline', 'duplexo' ) => 'outline',
				esc_attr__( '3d', 'duplexo' )      => '3d',
			),
			'std'         => 'classic',
			'description' => esc_attr__( 'Select call to action display style.', 'duplexo' ),
		),
		array(
			'type'        => 'dropdown',
			'heading'     => esc_attr__( 'Color', 'duplexo' ),
			'param_name'  => 'color',
			'value'       => array_merge( array( esc_attr__('Transparent', 'duplexo' ) => 'transparent' ), cymolthemes_getVcShared( 'colors-dashed' ) ),
			'std'         => 'transparent',
			'description' => esc_attr__( 'Select color for button.', 'duplexo' ),
			'param_holder_class' => 'cmt_vc_colored-dropdown vc_cta3-colored-dropdown',
			'dependency'  => array(
				'element'            => 'style',
				'value_not_equal_to' => array( 'custom' )
			),
		),
		array(
			'type'       => 'textarea_html',
			'heading'    => esc_attr__( 'Text', 'duplexo' ),
			'param_name' => 'content',
			'value'      => esc_attr__( 'I am promo text. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'duplexo' )
		),
		array(
			'type'       => 'dropdown',
			'heading'    => esc_attr__( 'Width', 'duplexo' ),
			'param_name' => 'el_width',
			'value'      => array(
					'100%' => '',
					'90%'  => 'xl',
					'80%'  => 'lg',
					'70%'  => 'md',
					'60%'  => 'sm',
					'50%'  => 'xs',
			),
			'description' => esc_attr__( 'Select call to action width (percentage).', 'duplexo' ),
		),
		array(
			'type'        => 'dropdown',
			'heading'     => esc_attr__( 'Add button', 'duplexo' ) . '?',
			'description' => esc_attr__( 'Add button for call to action.', 'duplexo' ),
			'std'		  => 'right',
			'param_name'  => 'add_button',
			'value'       => array(
				esc_attr__( 'No', 'duplexo' )     => '',
				esc_attr__( 'Top', 'duplexo' )    => 'top',
				esc_attr__( 'Bottom', 'duplexo' ) => 'bottom',
				esc_attr__( 'Left', 'duplexo' )   => 'left',
				esc_attr__( 'Right', 'duplexo' )  => 'right',
			),
		),
	),
	vc_map_integrate_shortcode( 'cmt-sboxbtn', 'btn_', esc_attr__( 'Button', 'duplexo' ),
		array(
			'exclude' => array( 'css' )
		),
		array(
			'element'   => 'add_button',
			'not_empty' => true,
		)
	),
	array(
		array(
			'type'        => 'dropdown',
			'heading'     => esc_attr__( 'Add icon?', 'duplexo' ),
			'description' => esc_attr__( 'Add icon for call to action.', 'duplexo' ),
			'param_name'  => 'add_icon',
			'value'       => array(
				esc_attr__( 'No', 'duplexo' )     => '',
				esc_attr__( 'Top', 'duplexo' )    => 'top',
				esc_attr__( 'Bottom', 'duplexo' ) => 'bottom',
				esc_attr__( 'Left', 'duplexo' )   => 'left',
				esc_attr__( 'Right', 'duplexo' )  => 'right',
			),
		),
		array(
			'type'        => 'dropdown',
			'heading'     => esc_attr__( 'Place icon on border?', 'duplexo' ),
			'description' => esc_attr__( 'Display icon on call to action element border.', 'duplexo' ),
			'param_name'  => 'i_on_border',
			'value'       => array(
				esc_attr__( 'No', 'duplexo' )     => 'false',
				esc_attr__( 'Yes', 'duplexo' )    => 'true',
			),
			'group'       => esc_attr__( 'Icon', 'duplexo' ),
			'dependency'  => array(
				'element'   => 'add_icon',
				'not_empty' => true,
			),
		),
		
	),
	vc_map_integrate_shortcode( 'cmt-sboxicon', 'i_', esc_attr__( 'Icon', 'duplexo' ),
		array(
			'exclude' => array( 'align', 'css' )
		),
		array(
			'element'   => 'add_icon',
			'not_empty' => true,
		)
	),
	array(
		/// cta3
		vc_map_add_css_animation(),
		cymolthemes_vc_ele_extra_class_option(),
		cymolthemes_vc_ele_css_editor_option(),
	)
);
	
global $cmt_sc_params_cta;
$cmt_sc_params_cta = $params;



vc_map( array(
	'name'     => esc_attr__( 'CymolThemes Call to Action', 'duplexo' ),
	'base'     => 'cmt-sboxcta',
	'icon'     => 'icon-cymolthemes-vc',
	'category' => array( esc_attr__( 'CymolThemes Special Elements', 'duplexo' ) ),
	'since'    => '4.5',
	'params'   => $params,
	'js_view'  => 'VcCallToActionView3',
) );