rep__property_search_filter_detail( $detail, $type="" $default=""" )

This function is used to retrieve details related to property search filters for listings. It allows you to get specific details based on the provided parameters, such as the detail to retrieve, the listing category or state, and a default value to return if the detail is not found.

Namespace

REP_Malcolm

Parameters

$detail

string

Details to get

$type

string

Listing Category or state

$default

string

Default value to return

Return

string

Listing state label

Source

File: \includes\rep-helper-functions.php

function rep__property_search_filter_detail($detail, $type="", $default=""){

    $type = strtolower( $type );

    $data = null;

    if( $detail == 'property_type_options' ){

        $property_type_options_group = lp__get_field_value(REP__PREFIX.'_listing_property_type_options','option');
        $field_value = lp__array_key_value( $type, $property_type_options_group );
        
        if( $field_value ){
            $data = [];
            $field_value = explode( "\n", $field_value );

            foreach( $field_value as $key => $value ){
                if( str_contains( $value, " : " ) ){
                    $key_value_pair = explode( " : ", $value );
                    $data[ lp__array_key_value( 0, $key_value_pair, $key ) ] = lp__array_key_value( 1, $key_value_pair, $value );
                }
            }    
        } else {
            $data = $field_value;
        }  
    } else {
        $search_form_group = lp__get_field_value(REP__PREFIX.'_listing_search_form','option');

        $data = lp__array_key_value( "{$type}_{$detail}", $search_form_group );
    }

    return $data ? $data : $default;

}