Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

get_simple_search_fields()

Parameters

This function accepts no parameters.

Location

include/search_functions.php lines 2314 to 2344

Definition

 
function get_simple_search_fields()
    {
    global 
$FIXED_LIST_FIELD_TYPES$country_search;
    
# Returns a list of fields suitable for the simple search box.
    # Standard field titles are translated using $lang.  Custom field titles are i18n translated.
   
    # First get all the fields
    
$allfields=get_resource_type_fields("","resource_type,order_by");
    
    
# Applies field permissions and translates field titles in the newly created array.
    
$return = array();
    for (
$n 0;$n<count($allfields);$n++)
        {
        if (
            
# Check if for simple_search
            # Also include the country field even if not selected
            # This is to provide compatibility for older systems on which the simple search box was not configurable
            # and had a simpler 'country search' option.
            
($allfields[$n]["simple_search"] == || (isset($country_search) && $country_search && $allfields[$n]["ref"] == 3))         
        &&
            
# Must be either indexed or a fixed list type
            
($allfields[$n]["keywords_index"] == || in_array($allfields[$n]["type"],$FIXED_LIST_FIELD_TYPES))
        &&    
            
metadata_field_view_access($allfields[$n]["ref"]) && !checkperm("T" $allfields[$n]["resource_type"] ))
            {
            
$allfields[$n]["title"] = lang_or_i18n_get_translated($allfields[$n]["title"], "fieldtitle-");            
            
$return[] = $allfields[$n];
            }
        }
    return 
$return;
    }

This article was last updated 12th July 2020 05:05 Europe/London time based on the source file dated 7th July 2020 15:22 Europe/London time.