API16:JTableNested/isLeaf
From Joomla! Documentation
Description
Method to determine if a node is a leaf node in the tree (has no children).
Syntax
isLeaf($pk=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $pk | null | Primary key of the node to check. |
Returns
boolean True if a leaf node.
Defined in
libraries/joomla/database/tablenested.php
Importing
jimport( 'joomla.database.tablenested' );
Source Body
public function isLeaf($pk = null)
{
// Initialise variables.
$k = $this->_tbl_key;
$pk = (is_null($pk)) ? $this->$k : $pk;
// Get the node by primary key.
if (!$node = $this->_getNode($pk)) {
// Error message set in getNode method.
return false;
}
// The node is a leaf node.
return (($node->rgt - $node->lft) == 1);
}
Examples
Code Examples