<?php
 
add_action( 'pxl_post_metabox_register', 'hubsteel_page_options_register' );
function hubsteel_page_options_register( $metabox ) {
 
	$panels = [
		'post' => [
			'opt_name'            => 'post_option',
			'display_name'        => esc_html__( 'Post Options', 'hubsteel' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'post_settings' => [
					'title'  => esc_html__( 'Post Options', 'hubsteel' ),
					'icon'   => 'el el-cog',
					'fields' => array_merge(
						hubsteel_sidebar_pos_opts(['prefix' => 'post_', 'default' => true, 'default_value' => '-1']),
						array(
							array(
								'id'=>'custom_post_number_carousel',
								'type' => 'text',
								'title'    => esc_html__('Custom Number For Post', 'hubsteel'),
							),
							array(
					            'id'=> 'post_video_link',
					            'type' => 'text',
					            'title' => esc_html__('Video Link', 'hubsteel'),
					            'validate' => 'url',
					            'default' => '',
					        ),
					        array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'margin',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Spacing Top/Bottom', 'hubsteel' ),
								'default'        => array(
									'margin-top'    => '',
									'margin-bottom' => '',
									'units'          => 'px',
								)
							),
					    ),
					    array(
							array(
								'id'          => 'featured-video-url',
								'type'        => 'text',
								'title'       => esc_html__( 'Video URL', 'hubsteel' ),
								'description' => esc_html__( 'Video will show when set post format is video', 'hubsteel' ),
								'validate'    => 'url',
								'msg'         => 'Url error!',
							),
							array(
								'id'          => 'featured-audio-url',
								'type'        => 'text',
								'title'       => esc_html__( 'Audio URL', 'hubsteel' ),
								'description' => esc_html__( 'Audio that will show when set post format is audio', 'hubsteel' ),
								'validate'    => 'url',
								'msg'         => 'Url error!',
							),
							array(
								'id'=>'featured-quote-text',
								'type' => 'textarea',
								'title' => esc_html__('Quote Text', 'hubsteel'),
								'default' => '',
							),
							array(
								'id'          => 'featured-quote-cite',
								'type'        => 'text',
								'title'       => esc_html__( 'Quote Cite', 'hubsteel' ),
								'description' => esc_html__( 'Quote will show when set post format is quote', 'hubsteel' ),
							),
							array(
								'id'       => 'featured-link-url',
								'type'     => 'text',
								'title'    => esc_html__( 'Format Link URL', 'hubsteel' ),
								'description' => esc_html__( 'Link will show when set post format is link', 'hubsteel' ),
							),
							array(
								'id'          => 'featured-link-text',
								'type'        => 'text',
								'title'       => esc_html__( 'Format Link Text', 'hubsteel' ),
							),
						)
					)
				],
				'page_title' => [
					'title'  => esc_html__( 'Page Title', 'hubsteel' ),
					'icon'   => 'el el-indent-left',
					'fields' => array_merge(
				        hubsteel_page_title_opts([
							'default'         => true,
							'default_value'   => '-1'
						])
				    )
				],
			]
		],
		'page' => [
			'opt_name'            => 'pxl_page_options',
			'display_name'        => esc_html__( 'Page Options', 'hubsteel' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'Header', 'hubsteel' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
				        hubsteel_header_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						hubsteel_header_mobile_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
				                'id'       => 'header_display',
				                'type'     => 'button_set',
				                'title'    => esc_html__('Header Display', 'hubsteel'),
				                'options'  => array(
				                    'show' => esc_html__('Show', 'hubsteel'),
				                    'hide'  => esc_html__('Hide', 'hubsteel'),
				                ),
				                'default'  => 'show',
				            ),
				            array(
				           		'id'       => 'logo_m',
					            'type'     => 'media',
					            'title'    => esc_html__('Mobile Logo', 'hubsteel'),
					            'default'  => '',
					            'url'      => false,
					        ),
					        array(
				                'id'       => 'p_menu',
				                'type'     => 'select',
				                'title'    => esc_html__( 'Menu', 'hubsteel' ),
				                'options'  => hubsteel_get_nav_menu_slug(),
				                'default' => '',
				            ),
					    ),
					    array(
				            array(
				                'id'       => 'sticky_scroll',
				                'type'     => 'button_set',
				                'title'    => esc_html__('Sticky Scroll', 'hubsteel'),
				                'options'  => array(
				                    '-1' => esc_html__('Inherit', 'hubsteel'),
				                    'pxl-sticky-stt' => esc_html__('Scroll To Top', 'hubsteel'),
				                    'pxl-sticky-stb'  => esc_html__('Scroll To Bottom', 'hubsteel'),
				                ),
				                'default'  => '-1',
				            ),
				            array(
				                'id'       => 'header_margin',
				                'type'     => 'spacing',
				                'mode'     => 'margin',
				                'title'    => esc_html__('Margin', 'hubsteel'),
				                'width'    => false,
				                'unit'     => 'px',
				                'output'    => array('#pxl-header-elementor .pxl-header-elementor-main'),
				            ),
				        )
				    )
					 
				],
				'page_title' => [
					'title'  => esc_html__( 'Page Title', 'hubsteel' ),
					'icon'   => 'el el-indent-left',
					'fields' => array_merge(
				        hubsteel_page_title_opts([
							'default'         => true,
							'default_value'   => '-1'
						])
				    )
				],
				'content' => [
					'title'  => esc_html__( 'Content', 'hubsteel' ),
					'icon'   => 'el-icon-pencil',
					'fields' => array_merge(
						hubsteel_sidebar_pos_opts(['prefix' => 'page_', 'default' => false, 'default_value' => '0']),
						array(
							array(
					            'id' => 'page_title_name',
					            'type' => 'text',
					            'title' => esc_html__('Page Title', 'hubsteel'),
					        ),
					        array(
					            'id' => 'sub_page_title',
					            'type' => 'text',
					            'title' => esc_html__('Sub Page Title', 'hubsteel'),
					        ),
					        array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'margin',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Spacing Top/Bottom', 'hubsteel' ),
								'default'        => array(
									'margin-top'    => '',
									'margin-bottom' => '',
									'units'          => 'px',
								)
							), 
					    )
					)
				],
				'footer' => [
					'title'  => esc_html__( 'Footer', 'hubsteel' ),
					'icon'   => 'el el-website',
					'fields' => array_merge(
				        hubsteel_footer_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
				                'id'       => 'footer_display',
				                'type'     => 'button_set',
				                'title'    => esc_html__('Footer Display', 'hubsteel'),
				                'options'  => array(
				                    'show' => esc_html__('Show', 'hubsteel'),
				                    'hide'  => esc_html__('Hide', 'hubsteel'),
				                ),
				                'default'  => 'show',
				            ),
							array(
				                'id'       => 'p_footer_fixed',
				                'type'     => 'button_set',
				                'title'    => esc_html__('Footer Fixed', 'hubsteel'),
				                'options'  => array(
				                    'inherit' => esc_html__('Inherit', 'hubsteel'),
				                    'on' => esc_html__('On', 'hubsteel'),
				                    'off' => esc_html__('Off', 'hubsteel'),
				                ),
				                'default'  => 'inherit',
				            ),
				            array(
				                'id'       => 'back_top_top_style',
				                'type'     => 'button_set',
				                'title'    => esc_html__('Back to Top Style', 'hubsteel'),
				                'options'  => array(
				                    'style-default' => esc_html__('Default', 'hubsteel'),
				                    'style-round' => esc_html__('Round', 'hubsteel'),
				                ),
				                'default'  => 'style-default',
				            ),
						)
				    )
				],
				'colors' => [
					'title'  => esc_html__( 'Colors', 'hubsteel' ),
					'icon'   => 'el el-website',
					'fields' => array_merge(
				        array(
				        	array(
					            'id'          => 'body_bg_color',
					            'type'        => 'color',
					            'title'       => esc_html__('Body Background Color', 'hubsteel'),
					            'transparent' => false,
					            'default'     => ''
					        ),
				        	array(
					            'id'          => 'primary_color',
					            'type'        => 'color',
					            'title'       => esc_html__('Primary Color', 'hubsteel'),
					            'transparent' => false,
					            'default'     => ''
					        ),
					        array(
					            'id'          => 'gradient_color',
					            'type'        => 'color_gradient',
					            'title'       => esc_html__('Gradient Color', 'hubsteel'),
					            'transparent' => false,
					            'default'  => array(
					                'from' => '',
					                'to'   => '', 
					            ),
					        ),
					    )
				    )
				],
				'extra' => [
					'title'  => esc_html__( 'Extra', 'hubsteel' ),
					'icon'   => 'el el-website',
					'fields' => array_merge(
				        array(
				        	array(
					            'id' => 'body_custom_class',
					            'type' => 'text',
					            'title' => esc_html__('Body Custom Class', 'hubsteel'),
					        ),
					    )
				    )
				]
			]
		],
		'portfolio' => [
			'opt_name'            => 'pxl_portfolio_options',
			'display_name'        => esc_html__( 'Portfolio Options', 'hubsteel' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'General', 'hubsteel' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
						array(
							array(
                                'id'          => 'date_finish',
                                'type'        => 'text',
                                'title'       => esc_html__( 'Date', 'hubsteel' ),
                            ),
                            array(
                                'id'          => 'materials',
                                'type'        => 'text',
                                'title'       => esc_html__( 'Materials', 'hubsteel' ),
                            ),
							array(
                                'id'          => 'location',
                                'type'        => 'text',
                                'title'       => esc_html__( 'Location', 'hubsteel' ),
                            ),
                            array(
                                'id'          => 'client',
                                'type'        => 'text',
                                'title'       => esc_html__( 'Client', 'hubsteel' ),
                            ),
                            array(
                                'id'          => 'tags',
                                'type'        => 'text',
                                'title'       => esc_html__( 'Tags', 'hubsteel' ),
                            ),
							array(
					            'id'=> 'portfolio_excerpt',
					            'type' => 'textarea',
					            'title' => esc_html__('Excerpt', 'hubsteel'),
					            'validate' => 'html_custom',
					            'default' => '',
					        ),
					        array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'margin',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Content Spacing Top/Bottom', 'hubsteel' ),
								'default'        => array(
									'margin-top'    => '',
									'margin-bottom' => '',
									'units'          => 'px',
								)
							),
						),
						hubsteel_footer_opts([
							'default'         => true,
							'default_value'   => '-1'
						])
				    )
				],
				'page_title' => [
					'title'  => esc_html__( 'Page Title', 'hubsteel' ),
					'icon'   => 'el el-indent-left',
					'fields' => array_merge(
				        hubsteel_page_title_opts([
							'default'         => true,
							'default_value'   => '-1'
						])
				    )
				],
			]
		],

		'service' => [
			'opt_name'            => 'pxl_service_options',
			'display_name'        => esc_html__( 'Service Options', 'hubsteel' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'General', 'hubsteel' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
						array(
							array(
					            'id'=> 'service_external_link',
					            'type' => 'text',
					            'title' => esc_html__('External Link', 'hubsteel'),
					            'validate' => 'url',
					            'default' => '',
					        ),
							array(
					            'id'=> 'service_excerpt',
					            'type' => 'textarea',
					            'title' => esc_html__('Excerpt', 'hubsteel'),
					            'validate' => 'html_custom',
					            'default' => '',
					        ),
					        array(
					            'id'       => 'service_icon_type',
					            'type'     => 'button_set',
					            'title'    => esc_html__('Icon Type', 'hubsteel'),
					            'options'  => array(
					                'icon'  => esc_html__('Icon', 'hubsteel'),
					                'image'  => esc_html__('Image', 'hubsteel'),
					            ),
					            'default'  => 'icon'
					        ),
					        array(
					            'id'       => 'service_icon_font',
					            'type'     => 'pxl_iconpicker',
					            'title'    => esc_html__('Icon', 'hubsteel'),
					            'required' => array( 0 => 'service_icon_type', 1 => 'equals', 2 => 'icon' ),
            					'force_output' => true
					        ),
					        array(
					            'id'       => 'service_icon_img',
					            'type'     => 'media',
					            'title'    => esc_html__('Icon Image', 'hubsteel'),
					            'default' => '',
					            'required' => array( 0 => 'service_icon_type', 1 => 'equals', 2 => 'image' ),
				            	'force_output' => true
					        ),
					        array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'margin',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Content Spacing Top/Bottom', 'hubsteel' ),
								'default'        => array(
									'margin-top'    => '',
									'margin-bottom' => '',
									'units'          => 'px',
								)
							),
							array(
								'id'=>'custom_service_title_carousel',
								'type' => 'text',
								'title'    => esc_html__('Custom Title For service', 'hubsteel'),
							),
							array(
								'id'=>'button_text',
								'type' => 'text',
								'title'    => esc_html__('Custom button text For service', 'hubsteel'),
							),
						),
						hubsteel_footer_opts([
							'default'         => true,
							'default_value'   => '-1'
						])
				    )
				],
				'page_title' => [
					'title'  => esc_html__( 'Page Title', 'hubsteel' ),
					'icon'   => 'el el-indent-left',
					'fields' => array_merge(
				        hubsteel_page_title_opts([
							'default'         => true,
							'default_value'   => '-1'
						])
				    )
				],
			]
		],

		'career' => [
			'opt_name'            => 'pxl_career_options',
			'display_name'        => esc_html__( 'Career Options', 'hubsteel' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'General', 'hubsteel' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
						array(
							array(
					            'id'=> 'career_excerpt',
					            'type' => 'textarea',
					            'title' => esc_html__('Excerpt', 'hubsteel'),
					            'validate' => 'html_custom',
					            'default' => '',
					        ),
					        array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'margin',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Content Spacing Top/Bottom', 'hubsteel' ),
								'default'        => array(
									'margin-top'    => '',
									'margin-bottom' => '',
									'units'          => 'px',
								)
							),
							array(
								'id'=>'custom_career_title_carousel',
								'type' => 'text',
								'title'    => esc_html__('Custom Title For career', 'hubsteel'),
							),
							array(
								'id'=>'button_text',
								'type' => 'text',
								'title'    => esc_html__('Custom button text For career', 'hubsteel'),
							),
						)
				    )
				],
				'career_page_title' => [
					'title'  => esc_html__( 'Career Page Title', 'hubsteel' ),
					'icon'   => 'el el-indent-left',
					'fields' => array_merge(
				        hubsteel_page_title_opts([
							'default'         => true,
							'default_value'   => '-1'
						])
				    )
				],
			]
		],

		'product' => [
			'opt_name'            => 'pxl_product_options',
			'display_name'        => esc_html__( 'Product Options', 'hubsteel' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header1' => [
					'title'  => esc_html__( 'Header', 'hubsteel' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
						hubsteel_header_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						hubsteel_header_mobile_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
								'id'       => 'header_display',
								'type'     => 'button_set',
								'title'    => esc_html__('Header Display', 'hubsteel'),
								'options'  => array(
									'show' => esc_html__('Show', 'hubsteel'),
									'hide'  => esc_html__('Hide', 'hubsteel'),
								),
								'default'  => 'show',
							),
							array(
								'id'       => 'p_menu',
								'type'     => 'select',
								'title'    => esc_html__( 'Menu', 'hubsteel' ),
								'options'  => hubsteel_get_nav_menu_slug(),
								'default' => '',
							),
						),
						array(
							array(
								'id'       => 'sticky_scroll',
								'type'     => 'button_set',
								'title'    => esc_html__('Sticky Scroll', 'hubsteel'),
								'options'  => array(
									'-1' => esc_html__('Inherit', 'hubsteel'),
									'pxl-sticky-stt' => esc_html__('Scroll To Top', 'hubsteel'),
									'pxl-sticky-stb'  => esc_html__('Scroll To Bottom', 'hubsteel'),
								),
								'default'  => '-1',
							),
							array(
								'id'       => 'header_margin',
								'type'     => 'spacing',
								'mode'     => 'margin',
								'title'    => esc_html__('Margin', 'hubsteel'),
								'width'    => false,
								'unit'     => 'px',
								'output'    => array('#pxl-header-elementor .pxl-header-elementor-main'),
							),
						)
					)
					
				],
				'page_title' => [
					'title'  => esc_html__( 'Page Title', 'hubsteel' ),
					'icon'   => 'el el-indent-left',
					'fields' => array_merge(
						hubsteel_page_title_opts([
							'default'         => true,
							'default_value'   => '-1'
						])
					)
				],
				'content' => [
					'title'  => esc_html__( 'Content', 'hubsteel' ),
					'icon'   => 'el-icon-pencil',
					'fields' => array_merge(
						hubsteel_sidebar_pos_opts(['prefix' => 'page_', 'default' => false, 'default_value' => '0']),
						array(
							array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'padding',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Spacing Top/Bottom', 'hubsteel' ),
								'default'        => array(
									'padding-top'    => '',
									'padding-bottom' => '',
									'units'          => 'px',
								)
							), 
						)
					)
				],
				'footer' => [
					'title'  => esc_html__( 'Footer', 'hubsteel' ),
					'icon'   => 'el el-website',
					'fields' => array_merge(
						hubsteel_footer_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
					)
				],
			]
		],

		'pxl-template' => [ //post_type
			'opt_name'            => 'pxl_hidden_template_options',
			'display_name'        => esc_html__( 'Template Options', 'hubsteel' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'General', 'hubsteel' ),
					'icon'   => 'el-icon-website',
					'fields' => array(
						array(
							'id'    => 'template_type',
							'type'  => 'select',
							'title' => esc_html__('Type', 'hubsteel'),
				            'options' => [
				            	'df'       	   => esc_html__('Select Type', 'hubsteel'), 
								'header'       => esc_html__('Header Desktop', 'hubsteel'),
								'header-mobile'       => esc_html__('Header Mobile', 'hubsteel'),
								'footer'       => esc_html__('Footer', 'hubsteel'), 
								'mega-menu'    => esc_html__('Mega Menu', 'hubsteel'), 
								'page-title'   => esc_html__('Page Title', 'hubsteel'), 
								'tab' => esc_html__('Tab', 'hubsteel'),
								'hidden-panel' => esc_html__('Hidden Panel', 'hubsteel'),
								'popup' => esc_html__('Popup', 'hubsteel'),
								'page' => esc_html__('Page', 'hubsteel'),
								'slider' => esc_html__('Slider', 'hubsteel'),
								'wgaboutauthor' => esc_html__('Widget Sidebar', 'hubsteel'),
				            ],
				            'default' => 'df',
				        ),
				        array(
							'id'    => 'header_type',
							'type'  => 'select',
							'title' => esc_html__('Header Type', 'hubsteel'),
				            'options' => [
				            	'px-header--default'       	   => esc_html__('Default', 'hubsteel'), 
								'px-header--transparent'       => esc_html__('Transparent', 'hubsteel'),
				            ],
				            'default' => 'px-header--default',
				            'indent' => true,
                			'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'header' ),
				        ),

				        array(
							'id'    => 'header_mobile_type',
							'type'  => 'select',
							'title' => esc_html__('Header Type', 'hubsteel'),
				            'options' => [
				            	'px-header--default'       	   => esc_html__('Default', 'hubsteel'), 
								'px-header--transparent'       => esc_html__('Transparent', 'hubsteel'),
				            ],
				            'default' => 'px-header--default',
				            'indent' => true,
                			'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'header-mobile' ),
				        ),

				        array(
							'id'    => 'hidden_panel_position',
							'type'  => 'select',
							'title' => esc_html__('Hidden Panel Position', 'hubsteel'),
				            'options' => [
				            	'top'       	   => esc_html__('Top', 'hubsteel'),
				            	'right'       	   => esc_html__('Right', 'hubsteel'),
				            ],
				            'default' => 'right',
				            'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'hidden-panel' ),
				        ),
				        array(
				            'id'          => 'hidden_panel_height',
				            'type'        => 'text',
				            'title'       => esc_html__('Hidden Panel Height', 'hubsteel'),
				            'subtitle'       => esc_html__('Enter number.', 'hubsteel'),
				            'transparent' => false,
				            'default'     => '',
				            'force_output' => true,
				            'required' => array( 0 => 'hidden_panel_position', 1 => 'equals', 2 => 'top' ),
				        ),
				        array(
				            'id'          => 'hidden_panel_boxcolor',
				            'type'        => 'color',
				            'title'       => esc_html__('Box Color', 'hubsteel'),
				            'transparent' => false,
				            'default'     => '',
				            'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'hidden-panel' ),
				        ),
					),
				    
				],
			]
		],
	];
 
	$metabox->add_meta_data( $panels );
}
 