Skip to content

Instantly share code, notes, and snippets.

@Zauberfisch
Created March 11, 2013 19:44
Show Gist options
  • Save Zauberfisch/5137067 to your computer and use it in GitHub Desktop.
Save Zauberfisch/5137067 to your computer and use it in GitHub Desktop.
/**
* Return children from the stage site
*
* @param showAll Inlcude all of the elements, even those not shown in the menus.
* (only applicable when extension is applied to {@link SiteTree}).
* @return SS_List
*/
public function stageChildren($showAll = false) {
$baseClass = ClassInfo::baseDataClass($this->owner->class);
$staged = $baseClass::get()->filter('ParentID', $this->owner->ID)->exclude('ID', $this->owner->ID);
if($this->owner->db('ShowInMenus') && !$showAll) {
$staged = $staged->filter('ShowInMenus', 1);
}
$this->owner->extend("augmentStageChildren", $staged, $showAll);
return $staged;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment