public function redirectionLink()
    {
        // Check external redirect
        if ($this->RedirectionType == 'External') {
            return $this->ExternalURL ?: null;
        }

        // Check internal redirect
        /** @var SiteTree $linkTo */
        $linkTo = $this->LinkToID ? SiteTree::get()->byID($this->LinkToID) : null;
        if (empty($linkTo)) {
            return null;
        }

        // We shouldn't point to ourselves - that would create an infinite loop!  Return null since we have a
        // bad configuration
        if ($this->ID == $linkTo->ID) {
            return null;
        }

        // If we're linking to another redirectorpage then just return the URLSegment, to prevent a cycle of redirector
        // pages from causing an infinite loop.  Instead, they will cause a 30x redirection loop in the browser, but
        // this can be handled sufficiently gracefully by the browser.
        if ($linkTo instanceof RedirectorPage) {
            return $linkTo->regularLink();
        }

        // For all other pages, just return the link of the page.
        return $linkTo->Link();
    }
public function redirectionLink()
    {
        // Check external redirect
        if ($this->RedirectionType == 'External') {
            return $this->ExternalURL ?: null;
        }

        // Check internal redirect
        /** @var SiteTree $linkTo */
        $linkTo = $this->LinkToID ? SiteTree::get()->byID($this->LinkToID) : null;
        if (empty($linkTo)) {
            return null;
        }

        // We shouldn't point to ourselves - that would create an infinite loop!  Return null since we have a
        // bad configuration
        if ($this->ID == $linkTo->ID) {
            return null;
        }

        // If we're linking to another redirectorpage then just return the URLSegment, to prevent a cycle of redirector
        // pages from causing an infinite loop.  Instead, they will cause a 30x redirection loop in the browser, but
        // this can be handled sufficiently gracefully by the browser.
        if ($linkTo instanceof RedirectorPage) {
            return $linkTo->regularLink();
        }

        // For all other pages, just return the link of the page.
        return $linkTo->Link();
    }
public function redirectionLink ( ) { // Check external redirect if ( $ this -> RedirectionType == 'External' ) { return $ this -> ExternalURL ? : null ; } // Check internal redirect /** @var SiteTree $linkTo */ $ linkTo = $ this -> LinkToID ? SiteTree :: get ( ) -> byID ( $ this -> LinkToID ) : null ; if ( empty ( $ linkTo ) ) { return null ; } // We shouldn't point to ourselves - that would create an infinite loop!  Return null since we have a // bad configuration if ( $ this -> ID == $ linkTo -> ID ) { return null ; } // If we're linking to another redirectorpage then just return the URLSegment, to prevent a cycle of redirector // pages from causing an infinite loop.  Instead, they will cause a 30x redirection loop in the browser, but // this can be handled sufficiently gracefully by the browser. if ( $ linkTo instanceof RedirectorPage ) { return $ linkTo -> regularLink ( ) ; } // For all other pages, just return the link of the page. return $ linkTo -> Link ( ) ; }
Return the link that we should redirect to.
Only return a value if there is a legal redirection destination.
Return the link that we should redirect to . Only return a value if there is a legal redirection destination .