Collections functions
General functions
Render functions
Theme permission 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 7420 to 7499

Definition

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

    if (
count($field_refs) === 0)
        {
        return array();
        }

    
$fields=ps_query("
        SELECT
               ref,
               name,
               title,
               field_constraint,
               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,
               external_user_access,
               autocomplete_macro,
               hide_when_uploading,
               hide_when_restricted,
               value_filter,
               exiftool_filter,
               omit_when_copying,
               tooltip_text,
               regexp_filter,
               sync_field,
               display_condition,
               onchange_macro,
               linked_data_field,
               automatic_nodes_ordering,
               fits_field,
               personal_data,
               include_in_csv_export,
               browse_bar,
               read_only,
               active,
               full_width
          FROM resource_type_field
         WHERE ref IN (" 
ps_param_insert(count($field_refs)) . ")
      ORDER BY order_by"
ps_param_fill($field_refs,"i"),"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 30th September 2022 17:05 Europe/London time based on the source file dated 30th September 2022 14:20 Europe/London time.