*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Render field template.
*
* @param string $field Field.
* @param string $label Label.
* @param string $type Type.
*/
function opalestate_property_render_field_template( $field, $label, $type = 'select' ) {
$qvalue = isset( $_GET['info'][ $field ] ) ? sanitize_text_field( $_GET['info'][ $field ] ) : '';
$template = '';
$template = apply_filters( 'opalestate_property_render_search_field_template', $field, $label );
$template = apply_filters( 'opalestate_property_' . $field . '_field_template', $template );
if ( $template == $field ) {
$template = '';
}
if ( empty( $template ) ) {
switch ( $type ) {
case 'input': ?>
' . esc_html( $label ) . '';
$template .= '';
$template = sprintf( $template, $field, $label );
break;
}
}
echo $template; // WPCS: XSS OK.
}
/**
* Render area size field.
*/
function opalestate_property_areasize_field_template( $template = '' ) {
$search_min = isset( $_GET['min_area'] ) ? sanitize_text_field( $_GET['min_area'] ) : opalestate_options( 'search_min_area', 0 );
$search_max = isset( $_GET['max_area'] ) ? sanitize_text_field( $_GET['max_area'] ) : opalestate_options( 'search_max_area', 1000 );
$data = [
'id' => 'area',
'unit' => opalestate_options( 'measurement_unit', 'sq ft' ) . ' ',
'ranger_min' => opalestate_options( 'search_min_area', 0 ),
'ranger_max' => opalestate_options( 'search_max_area', 1000 ),
'input_min' => $search_min,
'input_max' => $search_max,
];
opalesate_property_slide_ranger_template( esc_html__( 'Area', 'opalestate-pro' ), $data );
return;
}
add_filter( "opalestate_property_areasize_field_template", 'opalestate_property_areasize_field_template' );
/**
* Render slider ranger template.
*
* @param $label
* @param $data
*/
function opalesate_property_slide_ranger_template( $label, $data ) {
$default = [
'id' => 'price',
'unit' => '',
'decimals' => 0,
'ranger_min' => 0,
'ranger_max' => 1000,
'input_min' => 0,
'input_max' => 1000,
'unit_position' => 'postfix',
'mode' => 2,
'start' => '',
];
$data = array_merge( $default, $data );
extract( $data );
?>