<?php
/**
 * Modify the search from.
 *
 * @package SplendorStudio\Framework\Templates\Fragments
 *
 * @since   1.0.0
 */

// Filter.
Fancify_Lite_Actions::add_smart_action('get_search_form', 'fancify_lite_search_form');
/**
 * Modify the search form.
 *
 * @since 1.0.0
 *
 * @return string The form.
 */
function fancify_lite_search_form() {
	$output = fancify_lite_open_markup(
		'fancify_lite_search_form',
		'form',
		array(
			'class'  => 'fancify-search-form',
			'method' => 'get',
			'action' => esc_url( home_url('/') ),
			'role'   => 'search',
		)
	);

	/**
	 * Input label for screen readers.
	 *
	 * @since 1.0.0
	 */
	$output .= fancify_lite_open_markup(
		'fancify_lite_search_form_input[_label]',
		'label',
		array(
			'class'    => 'screen-reader-text',
			'for'      => 'fancifySearchInput',
		)
	);

	$output .= fancify_lite_close_markup( 'fancify_lite_search_form_input[_label]', 'label' );

	$output .= fancify_lite_selfclose_markup(
		'fancify_lite_search_form_input',
		'input',
		array(
			'class'       => 'fancify-search-input',
			'type'        => 'search',
			'placeholder' => __('Keyword...', 'fancify-lite'),
			'value'       => esc_attr( get_search_query() ),
			'name'        => 's',
			'id'          => 'fancifySearchInput'
		)
	); 

	$output .= fancify_lite_open_markup( 'fancify_lite_search_form_input_button', 'input', array( 'class' => 'fancify-widget-search-form-button', 'type' => 'submit' , 'value' =>  __('Search', 'fancify-lite') ) );

	$output .= fancify_lite_close_markup('fancify_lite_search_form', 'form');

	return $output;
}