Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 8033 to 8062

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 " 
columns_in("resource_type_field","rtf") . ", t.name AS tab_name
          FROM resource_type_field rtf
          LEFT JOIN tab t ON t.ref=rtf.tab          
         WHERE rtf.ref IN (" 
ps_param_insert(count($field_refs)) . ")
      ORDER BY rtf.order_by"
ps_param_fill($field_refs,"i"),"schema");

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

    return 
$return;
    }

This article was last updated 23rd July 2024 21:35 Europe/London time based on the source file dated 23rd July 2024 11:20 Europe/London time.