Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

get_simple_search_fields()

Parameters

This function accepts no parameters.

Location

include/search_functions.php lines 2662 to 2692

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("","global,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"]))
            {
            
$allfields[$n]["title"] = lang_or_i18n_get_translated($allfields[$n]["title"], "fieldtitle-");            
            
$return[] = $allfields[$n];
            }
        }
    return 
$return;
    }

This article was last updated 15th March 2024 05:05 Europe/London time based on the source file dated 8th March 2024 15:10 Europe/London time.