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

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 19th March 2024 09:05 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.