Collections functions
General functions
Render functions
Theme permission functions
Resource functions

get_nodes_use_count()

Description

Get a count of how many resources are using the specified nodes

Parameters

ColumnTypeDefaultDescription
$nodes array Array of node refs

Return

array Array of node ref as keys and number of resources using them as the values

Location

include/node_functions.php lines 2538 to 2552

Definition

 
function get_nodes_use_count(array $nodes)
    {
    
$nodes array_filter($nodes'is_int_loose');
    if(empty(
$nodes))
        {
        return [];
        }

    
$nodes_use_count ps_query(
        
'SELECT node, COUNT(node) AS `use_count` FROM resource_node WHERE node IN (' ps_param_insert(count($nodes)) . ') GROUP BY node',
        
ps_param_fill($nodes'i')
    );

    return 
array_column($nodes_use_count'use_count''node');
    }

This article was last updated 26th September 2022 12:35 Europe/London time based on the source file dated 21st September 2022 17:25 Europe/London time.