code/WTLink.php
public function Link()
    {
        $link = '';
        switch ($this->type) {
            case 'Internal' :
                if ($this->internal && ($page = SiteTree::get()->byID($this->internal))) {
                    $link = $page->Link();
                }
                break;
            case 'External' :
                $link = $this->external;
                break;
            case 'Email' :
                $link = $this->email ? 'mailto:' . $this->email : '';
                break;
            case 'File' :
                if ($this->file) {
                    $link = File::get()->byID($this->file)->Filename;
                }
                break;
            case 'DataObject':
                if ($do = $this->getDO()) {
                    $link = $do->Link();
                }
                break;
        }

        if ($this->extra) {
            //added a query string, but no ? to start it
            if (strpos($this->extra, '=' !== false && strpos($this->extra, '?' === false))) {
                $link .= '?';
            }

            $link .= $this->extra;
        }

        if ($this->anchor) {
            $link .= '#' . $this->anchor;
        }

        return $link;
    }
public function Link()
    {
        $link = '';
        switch ($this->type) {
            case 'Internal' :
                if ($this->internal && ($page = SiteTree::get()->byID($this->internal))) {
                    $link = $page->Link();
                }
                break;
            case 'External' :
                $link = $this->external;
                break;
            case 'Email' :
                $link = $this->email ? 'mailto:' . $this->email : '';
                break;
            case 'File' :
                if ($this->file) {
                    $link = File::get()->byID($this->file)->Filename;
                }
                break;
            case 'DataObject':
                if ($do = $this->getDO()) {
                    $link = $do->Link();
                }
                break;
        }

        if ($this->extra) {
            //added a query string, but no ? to start it
            if (strpos($this->extra, '=' !== false && strpos($this->extra, '?' === false))) {
                $link .= '?';
            }

            $link .= $this->extra;
        }

        if ($this->anchor) {
            $link .= '#' . $this->anchor;
        }

        return $link;
    }
public function Link ( ) { $ link = '' ; switch ( $ this -> type ) { case 'Internal' : if ( $ this -> internal && ( $ page = SiteTree :: get ( ) -> byID ( $ this -> internal ) ) ) { $ link = $ page -> Link ( ) ; } break ; case 'External' : $ link = $ this -> external ; break ; case 'Email' : $ link = $ this -> email ? 'mailto:' . $ this -> email : '' ; break ; case 'File' : if ( $ this -> file ) { $ link = File :: get ( ) -> byID ( $ this -> file ) -> Filename ; } break ; case 'DataObject' : if ( $ do = $ this -> getDO ( ) ) { $ link = $ do -> Link ( ) ; } break ; } if ( $ this -> extra ) { //added a query string, but no ? to start it if ( strpos ( $ this -> extra , '=' !== false && strpos ( $ this -> extra , '?' === false ) ) ) { $ link .= '?' ; } $ link .= $ this -> extra ; } if ( $ this -> anchor ) { $ link .= '#' . $ this -> anchor ; } return $ link ; }
Determines the link by the type and what is set

@return mixed|string
Determines the link by the type and what is set