src/ORM/Hierarchy/Hierarchy.php
public function liveChildren($showAll = false, $onlyDeletedFromStage = false)
    {
        /** @var Versioned|DataObject|Hierarchy $owner */
        $owner = $this->owner;
        if (!$owner->hasExtension(Versioned::class) || !$owner->hasStages()) {
            throw new Exception('Hierarchy->liveChildren() only works with Versioned extension applied with staging');
        }

        $hideFromHierarchy = $owner->config()->hide_from_hierarchy;
        $hideFromCMSTree = $owner->config()->hide_from_cms_tree;
        $children = DataObject::get($owner->baseClass())
            ->filter('ParentID', (int)$owner->ID)
            ->exclude('ID', (int)$owner->ID)
            ->setDataQueryParam(array(
                'Versioned.mode' => $onlyDeletedFromStage ? 'stage_unique' : 'stage',
                'Versioned.stage' => 'Live'
            ));
        if ($hideFromHierarchy) {
            $children = $children->exclude('ClassName', $hideFromHierarchy);
        }
        if ($hideFromCMSTree && $this->showingCMSTree()) {
            $children = $children->exclude('ClassName', $hideFromCMSTree);
        }
        if (!$showAll && DataObject::getSchema()->fieldSpec($owner, 'ShowInMenus')) {
            $children = $children->filter('ShowInMenus', 1);
        }

        return $children;
    }
public function liveChildren($showAll = false, $onlyDeletedFromStage = false)
    {
        /** @var Versioned|DataObject|Hierarchy $owner */
        $owner = $this->owner;
        if (!$owner->hasExtension(Versioned::class) || !$owner->hasStages()) {
            throw new Exception('Hierarchy->liveChildren() only works with Versioned extension applied with staging');
        }

        $hideFromHierarchy = $owner->config()->hide_from_hierarchy;
        $hideFromCMSTree = $owner->config()->hide_from_cms_tree;
        $children = DataObject::get($owner->baseClass())
            ->filter('ParentID', (int)$owner->ID)
            ->exclude('ID', (int)$owner->ID)
            ->setDataQueryParam(array(
                'Versioned.mode' => $onlyDeletedFromStage ? 'stage_unique' : 'stage',
                'Versioned.stage' => 'Live'
            ));
        if ($hideFromHierarchy) {
            $children = $children->exclude('ClassName', $hideFromHierarchy);
        }
        if ($hideFromCMSTree && $this->showingCMSTree()) {
            $children = $children->exclude('ClassName', $hideFromCMSTree);
        }
        if (!$showAll && DataObject::getSchema()->fieldSpec($owner, 'ShowInMenus')) {
            $children = $children->filter('ShowInMenus', 1);
        }

        return $children;
    }
public function liveChildren ( $ showAll = false , $ onlyDeletedFromStage = false ) { /** @var Versioned|DataObject|Hierarchy $owner */ $ owner = $ this -> owner ; if ( ! $ owner -> hasExtension ( Versioned :: class ) || ! $ owner -> hasStages ( ) ) { throw new Exception ( 'Hierarchy->liveChildren() only works with Versioned extension applied with staging' ) ; } $ hideFromHierarchy = $ owner -> config ( ) -> hide_from_hierarchy ; $ hideFromCMSTree = $ owner -> config ( ) -> hide_from_cms_tree ; $ children = DataObject :: get ( $ owner -> baseClass ( ) ) -> filter ( 'ParentID' , ( int ) $ owner -> ID ) -> exclude ( 'ID' , ( int ) $ owner -> ID ) -> setDataQueryParam ( array ( 'Versioned.mode' => $ onlyDeletedFromStage ? 'stage_unique' : 'stage' , 'Versioned.stage' => 'Live' ) ) ; if ( $ hideFromHierarchy ) { $ children = $ children -> exclude ( 'ClassName' , $ hideFromHierarchy ) ; } if ( $ hideFromCMSTree && $ this -> showingCMSTree ( ) ) { $ children = $ children -> exclude ( 'ClassName' , $ hideFromCMSTree ) ; } if ( ! $ showAll && DataObject :: getSchema ( ) -> fieldSpec ( $ owner , 'ShowInMenus' ) ) { $ children = $ children -> filter ( 'ShowInMenus' , 1 ) ; } return $ children ; }
Return children in the live site, if it exists.

@param bool $showAll              Include all of the elements, even those not shown in the menus. Only
applicable when extension is applied to {@link SiteTree}.
@param bool $onlyDeletedFromStage Only return items that have been deleted from stage
@return DataList
@throws Exception
Return children in the live site if it exists .