isAncestor() public method

Checks if the given node id is an ancestor of the current node.
public isAncestor ( integer $id ) : boolean
$id integer
return boolean
Esempio n. 1
0
 /**
  * Checks if the given node id is an ancestor of
  * the current node.
  *
  * @param int $id
  * @return bool
  */
 public function isAncestor($id)
 {
     if (!is_null($this->parent)) {
         if ($this->parent->id() == $id) {
             return true;
         }
         return $this->parent->isAncestor($id);
     }
     return false;
 }