Collections functions
General functions
Render functions
Theme permission 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 1520 to 1543

Definition

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

        
$data ps_query(
               
"SELECT rn.`resource`, rn.node, n.resource_type_field, n.`name` AS `value`
                  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",
            [
'i'$ref]
        );
        foreach(
$data as $page_data)
            {
            yield 
$page_data;
            }
        }
    while (!empty(
$data) && count($data) === $rows);
    }

This article was last updated 2nd December 2022 20:35 Europe/London time based on the source file dated 25th November 2022 11:35 Europe/London time.