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

get_resources_nodes_by_rtf()

Description

Get all resource nodes associated for a specific resource type field.

Parameters

ColumnTypeDefaultDescription
$ref integer Resource type field ID

Return

Generator

Location

include/node_functions.php lines 1480 to 1508

Definition

 
function get_resources_nodes_by_rtf(int $ref)
    {
    
$offset null;
    do
        {
        
$rows 1000;
        
$sql_limit sql_limit($offset$rows);
        
$offset += $rows;

        
$parameters= [];
        
$sql columns_in("node","n");
        
add_sql_node_language($sql,$parameters,"n");
        
        
$parameters array_merge($parameters,['i'$ref]);
        
$data ps_query(
               
"SELECT " $sql "
                  FROM resource_node AS rn
            INNER JOIN node AS n ON rn.node = n.ref AND n.resource_type_field = ?
            INNER JOIN resource AS r ON rn.resource = r.ref
            
$sql_limit",
            
$parameters            
        
);
        foreach(
$data as $page_data)
            {
            yield 
$page_data;
            }
        }
    while (!empty(
$data) && count($data) === $rows);
    }

This article was last updated 21st May 2024 12:05 Europe/London time based on the source file dated 14th May 2024 18:25 Europe/London time.