removeSubtree() public méthode

Removes a part of the page hierarchy starting from the specified page.
public removeSubtree ( Cms\Classes\Page $page )
$page Cms\Classes\Page Specifies a page object.
Exemple #1
0
 /**
  * Deletes the object from the disk.
  * Recursively deletes subpages. Returns a list of file names of deleted pages.
  * @return array
  */
 public function delete()
 {
     $result = [];
     /*
      * Delete subpages
      */
     foreach ($this->getChildren() as $subPage) {
         $result = array_merge($result, $subPage->delete());
     }
     /*
      * Remove from meta
      */
     $pageList = new PageList($this->theme);
     $pageList->removeSubtree($this);
     /*
      * Delete the object
      */
     $result = array_merge($result, [$this->getBaseFileName()]);
     parent::delete();
     return $result;
 }
Exemple #2
0
 /**
  * Removes this page to the meta index.
  */
 protected function removeFromMeta()
 {
     $pageList = new PageList($this->theme);
     $pageList->removeSubtree($this);
 }