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

is_parent_node()

Description

Checks whether a node is parent to other nodes or not

Parameters

ColumnTypeDefaultDescription
$ref int Node ref
$active_only bool false: bool { ifis_null$ref Check only for active (children) nodes

Location

include/node_functions.php lines 435 to 447

Definition

 
function is_parent_node($refbool $active_only false): bool
    
{
    if(
is_null($ref))
        {
        return 
false;
        }

    
$query $active_only
        
'SELECT exists (SELECT ref from node WHERE parent = ? AND active = 1) AS `value`'
        
'SELECT exists (SELECT ref from node WHERE parent = ?) AS `value`';

    return 
ps_value($query, ['i'$ref], 0) > 0;
    }

This article was last updated 27th April 2024 21:35 Europe/London time based on the source file dated 15th April 2024 11:30 Europe/London time.