<?php
/**
 * Settings
 *
 * @package     Wow_Plugin
 * @copyright   Copyright (c) 2018, Dmytro Lobov
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.0
 */


$count_i = ( ! empty( $param['menu_1']['item_type'] ) ) ? count( $param['menu_1']['item_type'] ) : '0';
if ( $count_i > 0 ) {
	for ( $i = 0; $i < $count_i; $i ++ ) {

		// Order of the menu
//    $item_order_[ $i ] = array (
//    	'name' => 'param[item_order][]',
//    	'id'   => 'item_order',
//    	'type' => 'hidden',
//    	'val'  => isset( $param['item_order'][ $i ] ) ? $param['item_order'][ $i ] : '',
//    );

		// Icon
		$item_icon_[ $i ] = array(
			'name'   => 'param[menu_1][item_icon][]',
			'class'  => 'icons',
			'type'   => 'select',
			'val'    => isset( $param['menu_1']['item_icon'][ $i ] ) ? $param['menu_1']['item_icon'][ $i ]
				: 'fas fa-hand-point-up',
			'option' => $icons_new,
		);

		// Select custom icon
		$item_custom_[ $i ] = array(
			'name'  => 'param[menu_1][item_custom][]',
			'type'  => 'checkbox',
			'class' => 'custom-icon',
			'val'   => isset( $param['menu_1']['item_custom'][ $i ] ) ? $param['menu_1']['item_custom'][ $i ] : 0,
			'func'  => 'customicon(this);',
		);

		// Custom icon URL
		$item_custom_link_[ $i ] = array(
			'name'   => 'param[menu_1][item_custom_link][]',
			'type'   => 'text',
			'class'  => 'custom-icon-url',
			'val'    => isset( $param['menu_1']['item_custom_link'][ $i ] ) ? $param['menu_1']['item_custom_link'][ $i ]
				: '',
			'option' => array(
				'placeholder' => esc_attr__( 'Enter Icon URL', 'side-menu' ),
			),
		);

		// Label for item
		$item_tooltip_[ $i ] = array(
			'name'  => 'param[menu_1][item_tooltip][]',
			'class' => 'item-tooltip',
			'type'  => 'text',
			'val'   => isset( $param['menu_1']['item_tooltip'][ $i ] ) ? $param['menu_1']['item_tooltip'][ $i ] : '',
		);


//    $smooth = isset( $param[ 'menu_1' ][ 'scroll' ][ $i ] ) ? $param[ 'menu_1' ][ 'scroll' ][ $i ] : '';

		// Type of the item
		$item_type_[ $i ] = array(
			'name'   => 'param[menu_1][item_type][]',
			'type'   => 'select',
			'class'  => 'item-type',
			'val'    => isset( $param['menu_1']['item_type'][ $i ] ) ? $param['menu_1']['item_type'][ $i ] : '',
			'option' => array(
				'link'         => esc_attr__( 'Link', 'side-menu' ),
				'share'        => esc_attr__( 'Share', 'side-menu' ),
				'print'        => esc_attr__( 'Print', 'side-menu' ),
				'totop'        => esc_attr__( 'Scroll to Top', 'side-menu' ),
				'smoothscroll' => esc_attr__( 'Smooth Scroll', 'side-menu' ),
				'goback'       => esc_attr__( 'Go Back', 'side-menu' ),
				'goforward'    => esc_attr__( 'Go Forward', 'side-menu' ),
				'email'        => esc_attr__( 'Email', 'side-menu' ),
				'telephone'    => esc_attr__( 'Telephone', 'side-menu' ),
				'login'        => esc_attr__( 'Login', 'side-menu' ),
				'logout'       => esc_attr__( 'Logout', 'side-menu' ),
				'register'     => esc_attr__( 'Register', 'side-menu' ),
				'lostpassword' => esc_attr__( 'Lostpassword', 'side-menu' ),
				'modal'        => esc_attr__( 'Open Modal Window', 'side-menu' ),
				'shiftnav'     => esc_attr__( 'ShiftNav Menu', 'side-menu' ),
			),
			'func'   => 'itemtype(this);',
		);


		// Link URL
		$item_link_[ $i ] = array(
			'name' => 'param[menu_1][item_link][]',
			'type' => 'text',
			'val'  => isset( $param['menu_1']['item_link'][ $i ] ) ? $param['menu_1']['item_link'][ $i ] : '',
		);


		// Open link in a new window
		$new_tab_[ $i ] = array(
			'name'  => 'param[menu_1][new_tab][]',
			'class' => '',
			'type'  => 'checkbox',
			'val'   => isset( $param['menu_1']['new_tab'][ $i ] ) ? $param['menu_1']['new_tab'][ $i ] : 0,
			'func'  => '',
			'sep'   => '',
		);

		// Smooth scroll
//    $scroll_[ $i ] = array(
//      'name'  => 'param[menu_1][scroll][]',
//      'class' => '',
//      'type'  => 'checkbox',
//      'val'   => isset( $param[ 'menu_1' ][ 'scroll' ][ $i ] ) ? $param[ 'menu_1' ][ 'scroll' ][ $i ] : 0,
//      'func'  => '',
//      'sep'   => '',
//    );

		// Social Networks
		$item_share_[ $i ] = array(
			'name'   => 'param[menu_1][item_share][]',
			'type'   => 'select',
			'val'    => isset( $param['menu_1']['item_share'][ $i ] ) ? $param['menu_1']['item_share'][ $i ] : '',
			'option' => array(
				'Facebook'      => esc_attr__( 'Facebook', 'side-menu' ),
				'VK'            => esc_attr__( 'VK', 'side-menu' ),
				'Twitter'       => esc_attr__( 'Twitter', 'side-menu' ),
				'Linkedin'      => esc_attr__( 'Linkedin', 'side-menu' ),
				'Odnoklassniki' => esc_attr__( 'Odnoklassniki', 'side-menu' ),
				'Google'        => esc_attr__( 'Google', 'side-menu' ),
				'Pinterest'     => esc_attr__( 'Pinterest', 'side-menu' ),
				'xing'          => esc_attr__( 'XING', 'side-menu' ),
				'myspace'       => esc_attr__( 'Myspace', 'side-menu' ),
				'weibo'         => esc_attr__( 'Weibo', 'side-menu' ),
				'buffer'        => esc_attr__( 'Buffer', 'side-menu' ),
				'stumbleupon'   => esc_attr__( 'StumbleUpon', 'side-menu' ),
				'reddit'        => esc_attr__( 'Reddit', 'side-menu' ),
				'tumblr'        => esc_attr__( 'Tumblr', 'side-menu' ),
				'blogger'       => esc_attr__( 'Blogger', 'side-menu' ),
				'livejournal'   => esc_attr__( 'LiveJournal', 'side-menu' ),
				'pocket'        => esc_attr__( 'Pocket', 'side-menu' ),
				'telegram'      => esc_attr__( 'Telegram', 'side-menu' ),
				'skype'         => esc_attr__( 'Skype', 'side-menu' ),
				'email'         => esc_attr__( 'Email', 'side-menu' ),
			),
			'func'   => '',
		);

		// Modal
		$item_modal_[ $i ] = array(
			'name' => 'param[menu_1][item_modal][]',
			'type' => 'text',
			'val'  => isset( $param['menu_1']['item_modal'][ $i ] ) ? $param['menu_1']['item_modal'][ $i ] : '',
		);

		// Font color
		$color_[ $i ] = array(
			'name' => 'param[menu_1][color][]',
			'type' => 'color',
			'val'  => isset( $param['menu_1']['color'][ $i ] ) ? $param['menu_1']['color'][ $i ] : '#ffffff',
		);

		// Icon Сolor
		$iconcolor_[ $i ] = array(
			'name' => 'param[menu_1][iconcolor][]',
			'type' => 'color',
			'val'  => isset( $param['menu_1']['iconcolor'][ $i ] ) ? $param['menu_1']['iconcolor'][ $i ] : '#ffffff',
		);

		// Background
		$bcolor_[ $i ] = array(
			'name' => 'param[menu_1][bcolor][]',
			'type' => 'color',
			'val'  => isset( $param['menu_1']['bcolor'][ $i ] ) ? $param['menu_1']['bcolor'][ $i ] : '#128be0',
		);

		// Background Hover
		$hbcolor_[ $i ] = array(
			'name' => 'param[menu_1][hbcolor][]',
			'type' => 'color',
			'val'  => isset( $param['menu_1']['hbcolor'][ $i ] ) ? $param['menu_1']['hbcolor'][ $i ] : '#128be0',
		);

		// Update to version 4.0
		$link_type = isset($param['menu_1']['item_type'][ $i ]) ? $param['menu_1']['item_type'][ $i ] : '';
		$class_id = '';
		if ($link_type === 'id') {
			$class_id = !empty($param['menu_1']['item_modal'][ $i ]) ? $param['menu_1']['item_modal'][ $i ] : '';
			$param['menu_1']['button_id'][ $i ] = $class_id;
			$param['menu_1']['item_type'][ $i ] = 'link';
		}
		elseif ($link_type === 'class'){
			$class_id = !empty($param['menu_1']['item_modal'][ $i ]) ? $param['menu_1']['item_modal'][ $i ] : '';
			$param['menu_1']['button_class'][ $i ] = $class_id;
			$param['menu_1']['item_type'][ $i ] = 'link';
		}

		$button_id_[ $i ] = array(
			'name' => 'param[menu_1][button_id][]',
			'type' => 'text',
			'val'  => isset( $param['menu_1']['button_id'][ $i ] ) ? $param['menu_1']['button_id'][ $i ] : $class_id,
		);

		$button_class_[ $i ] = array(
			'name' => 'param[menu_1][button_class][]',
			'type' => 'text',
			'val'  => isset( $param['menu_1']['button_class'][ $i ] ) ? $param['menu_1']['button_class'][ $i ] : $class_id,
		);

		// Hold open item when menu load
		$hold_open_[ $i ] = array(
			'name'  => 'param[menu_1][hold_open][]',
			'class' => '',
			'type'  => 'checkbox',
			'val'   => isset( $param['menu_1']['hold_open'][ $i ] ) ? $param['menu_1']['hold_open'][ $i ] : 0,
			'func'  => '',
			'sep'   => '',
		);

		// Modal
		$item_modal_[ $i ] = array(
			'name' => 'param[menu_1][item_modal][]',
			'type' => 'text',
			'val'  => isset( $param['menu_1']['item_modal'][ $i ] ) ? $param['menu_1']['item_modal'][ $i ] : '',
		);

	}

}


$item_icon_help = array(
	'title' => esc_attr__( 'Set the icon for menu item. If you want use the custom item:', 'side-menu' ),
	'ul'    => array(
		esc_attr__( '1. Check the box on "custom"', 'side-menu' ),
		esc_attr__( '2. Upload the icon in Media Library', 'side-menu' ),
		esc_attr__( '3. Copy the URL to icon', 'side-menu' ),
		esc_attr__( '4. Paste the icon URL to field', 'side-menu' ),
	),
);

$item_tooltip_help = array(
	'text' => esc_attr__( 'Set the text for menu item.', 'side-menu' ),
);

$item_type_help = array(
	'text' => esc_attr__( 'Select the type of menu item. Explanation of some types:', 'side-menu' ),
	'ul'   => array(
		esc_attr__( '<strong>Smooth Scroll</strong> - Smooth scrolling of the page to the specified anchors on the page.',
			'side-menu' ),
		esc_attr__( '<strong>ShiftNav Menu</strong> - open the menu, wich create via the plugin ShiftNav.',
			'side-menu' ),
	),
);

$hold_open_help = array(
	'text' => esc_attr__( 'When the page loads, the menu item will open.', 'side-menu' ),
);

$button_id_help = array(
	'text' => esc_attr__( 'Set the attribute ID for the menu item or left empty.', 'side-menu' ),
);

$button_class_help = array(
	'text' => esc_attr__( 'Set the attribute CLASS for the menu item or left empty.', 'side-menu' ),
);