protected function getListingSource()
    {
        $sourceType = $this->effectiveSourceType();
        if ($sourceType && $this->ListingSourceID) {
            $parentId = $this->ListingSourceID;
            $source = DataList::create($sourceType)->byID($parentId);

            $newParent = null;

            $newParentId = 0;
            if ($this->AllowDrilldown) {
                $newParentId = Controller::has_curr() ? (int) Controller::curr()->getRequest()->param('Action') : 0;
            }

            if ($newParentId) {
                /* @var $source DataObject */
                if ($source) {
                    $newParent = $sourceType::get()->byId($newParentId);
                    if ($newParent) {
                        // figure out whether it's within the source already configured there by looking up through the
                        // tree until we find the listing source ID parent, at which point we can
                        // safely swap to it
                        //
                        // - nyeholt 2017-12-18
                        $parentCheck = $newParent;
                        while ($parentCheck) {
                            if ($parentCheck->ID == $source->ID) {
                                $source = $newParent;
                                break;
                            }
                            $parentCheck = $parentCheck->Parent();
                        }
                    }
                }
            }

            if ($source && $source->canView()) {
                return $source;
            }
        }
    }
protected function getListingSource()
    {
        $sourceType = $this->effectiveSourceType();
        if ($sourceType && $this->ListingSourceID) {
            $parentId = $this->ListingSourceID;
            $source = DataList::create($sourceType)->byID($parentId);

            $newParent = null;

            $newParentId = 0;
            if ($this->AllowDrilldown) {
                $newParentId = Controller::has_curr() ? (int) Controller::curr()->getRequest()->param('Action') : 0;
            }

            if ($newParentId) {
                /* @var $source DataObject */
                if ($source) {
                    $newParent = $sourceType::get()->byId($newParentId);
                    if ($newParent) {
                        // figure out whether it's within the source already configured there by looking up through the
                        // tree until we find the listing source ID parent, at which point we can
                        // safely swap to it
                        //
                        // - nyeholt 2017-12-18
                        $parentCheck = $newParent;
                        while ($parentCheck) {
                            if ($parentCheck->ID == $source->ID) {
                                $source = $newParent;
                                break;
                            }
                            $parentCheck = $parentCheck->Parent();
                        }
                    }
                }
            }

            if ($source && $source->canView()) {
                return $source;
            }
        }
    }
protected function getListingSource ( ) { $ sourceType = $ this -> effectiveSourceType ( ) ; if ( $ sourceType && $ this -> ListingSourceID ) { $ parentId = $ this -> ListingSourceID ; $ source = DataList :: create ( $ sourceType ) -> byID ( $ parentId ) ; $ newParent = null ; $ newParentId = 0 ; if ( $ this -> AllowDrilldown ) { $ newParentId = Controller :: has_curr ( ) ? ( int ) Controller :: curr ( ) -> getRequest ( ) -> param ( 'Action' ) : 0 ; } if ( $ newParentId ) { /* @var $source DataObject */ if ( $ source ) { $ newParent = $ sourceType :: get ( ) -> byId ( $ newParentId ) ; if ( $ newParent ) { // figure out whether it's within the source already configured there by looking up through the // tree until we find the listing source ID parent, at which point we can // safely swap to it // // - nyeholt 2017-12-18 $ parentCheck = $ newParent ; while ( $ parentCheck ) { if ( $ parentCheck -> ID == $ source -> ID ) { $ source = $ newParent ; break ; } $ parentCheck = $ parentCheck -> Parent ( ) ; } } } } if ( $ source && $ source -> canView ( ) ) { return $ source ; } } }
Some subclasses will want to override this.

@return DataObject
Some subclasses will want to override this .