Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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 8219 to 8248

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 15th December 2024 11:35 Europe/London time based on the source file dated 13th December 2024 14:45 Europe/London time.