Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

get_fields()

Description

Returns a list of fields with refs matching the supplied field refs.

Parameters

ColumnTypeDefaultDescription
$field_refs array Array of field refs

Return

array

Location

include/resource_functions.php lines 7463 to 7518

Definition

 
function get_fields($field_refs)
    {
    if(!
is_array($field_refs))
        {
        
trigger_error("\$field_refs passed to get_fields() is not an array.");
        }

    
$fields=sql_query("
        SELECT *,
               ref,
               name,
               title,
               type,
               order_by,
               keywords_index,
               partial_index,
               resource_type,
               resource_column,
               display_field,
               use_for_similar,
               iptc_equiv,
               display_template,
               tab_name,
               required,
               smart_theme_name,
               exiftool_field,
               advanced_search,
               simple_search,
               help_text,
               display_as_dropdown,
               tooltip_text,
               display_condition,
               onchange_macro
          FROM resource_type_field
         WHERE ref IN ('" 
join("','",$field_refs) . "')
      ORDER BY order_by"
"schema");

    
$return = array();
    foreach(
$fields as $field)
        {
        if(
metadata_field_view_access($field['ref']))
            {
            
$return[] = $field;
            }
        }

    
/*for($n = 0; $n < count($fields); $n++)
        {
        if(metadata_field_view_access($fields[$n]["ref"]))
            {
            $return[]=$fields[$n];
            }
        }*/

    
return $return;
    }

This article was last updated 24th November 2020 17:35 Europe/London time based on the source file dated 13th November 2020 16:50 Europe/London time.