<?php

if ( ! function_exists( 'eona_core_add_404_page_options' ) ) {
	/**
	 * Function that add general options for this module
	 */
	function eona_core_add_404_page_options() {
		$qode_framework = qode_framework_get_framework_root();

		$page = $qode_framework->add_options_page(
			array(
				'scope'       => EONA_CORE_OPTIONS_NAME,
				'type'        => 'admin',
				'slug'        => '404',
				'icon'        => 'fa fa-book',
				'title'       => esc_html__( '404', 'eona-core' ),
				'description' => esc_html__( 'Global 404 Page Options', 'eona-core' )
			)
		);
		
		if ( $page ) {
			$page->add_field_element(
				array(
					'field_type'    => 'yesno',
					'name'          => 'qodef_enable_404_page_title',
					'title'         => esc_html__( 'Enable Page Title', 'eona-core' ),
					'description'   => esc_html__( 'Use this option to enable/disable page title on 404 page', 'eona-core' ),
					'default_value' => 'no'
				)
			);
			
			$page->add_field_element(
				array(
					'field_type'    => 'yesno',
					'name'          => 'qodef_enable_404_page_footer',
					'title'         => esc_html__( 'Enable Page Footer', 'eona-core' ),
					'description'   => esc_html__( 'Use this option to enable/disable page footer on 404 page', 'eona-core' ),
					'default_value' => 'no'
				)
			);
			
			$page->add_field_element(
				array(
					'field_type'  => 'color',
					'name'        => 'qodef_404_page_background_color',
					'title'       => esc_html__( 'Background Color', 'eona-core' ),
					'description' => esc_html__( 'Enter 404 page area background color', 'eona-core' )
				)
			);
			
			$page->add_field_element(
				array(
					'field_type'  => 'image',
					'name'        => 'qodef_404_page_background_image',
					'title'       => esc_html__( 'Background Image', 'eona-core' ),
					'description' => esc_html__( 'Enter 404 page area background image', 'eona-core' )
				)
			);
			
			$page->add_field_element(
				array(
					'field_type' => 'text',
					'name'       => 'qodef_404_page_title',
					'title'      => esc_html__( 'Title Label', 'eona-core' )
				)
			);
			
			$page->add_field_element(
				array(
					'field_type' => 'color',
					'name'       => 'qodef_404_page_title_color',
					'title'      => esc_html__( 'Title Color', 'eona-core' )
				)
			);
			
			$page->add_field_element(
				array(
					'field_type' => 'text',
					'name'       => 'qodef_404_page_text',
					'title'      => esc_html__( 'Text Label', 'eona-core' )
				)
			);

            $page->add_field_element(
                array(
                    'field_type'  => 'text',
                    'name'        => 'qodef_404_page_italic_text',
                    'title'       => esc_html__( 'Text Words in Italic', 'eona-core' ),
                    'description' => esc_html__( 'To have certain words highlighted in italic, enter their order number here, separated by commas. For example, "3, 6" will highlight the 3rd and 6th word.', 'eona-core' )
                )
            );
			
			$page->add_field_element(
				array(
					'field_type' => 'color',
					'name'       => 'qodef_404_page_text_color',
					'title'      => esc_html__( 'Text Color', 'eona-core' )
				)
			);
			
			$page->add_field_element(
				array(
					'field_type' => 'text',
					'name'       => 'qodef_404_page_button_text',
					'title'      => esc_html__( 'Button Text', 'eona-core' )
				)
			);

            $page->add_field_element(
                array(
                    'field_type'    => 'select',
                    'name'          => 'qodef_404_page_button_skin',
                    'title'         => esc_html__( 'Button Skin', 'eona-core' ),
                    'options'       => array(
                        'dark'  => esc_html__( 'Dark', 'eona-core' ),
                        'light' => esc_html__( 'Light', 'eona-core' ),
                    ),
                    'default_value' => 'dark'
                )
            );

            // Hook to include additional options after module options
			do_action( 'eona_core_action_after_404_page_options_map', $page );
		}
	}
	
	add_action( 'eona_core_action_default_options_init', 'eona_core_add_404_page_options', eona_core_get_admin_options_map_position( '404' ) );
}