src/Url/UrlUtil.php
protected function prepareUrl($url)
    {
        if (null === $url) {
            $url = Environment::get('requestUri');
        } elseif (is_numeric($url)) {
            if (null === ($jumpTo = $this->framework->getAdapter(PageModel::class)->findByPk($url))) {
                throw new \InvalidArgumentException('Given page id does not exist.');
            }

            $url = $this->framework->getAdapter(Controller::class)->generateFrontendUrl($jumpTo->row());

            list(, $queryString) = explode('?', Environment::get('request'), 2);

            if ('' != $queryString) {
                $url .= '?'.$queryString;
            }
        }

        $url = ampersand($url, false);

        return $url;
    }
protected function prepareUrl($url)
    {
        if (null === $url) {
            $url = Environment::get('requestUri');
        } elseif (is_numeric($url)) {
            if (null === ($jumpTo = $this->framework->getAdapter(PageModel::class)->findByPk($url))) {
                throw new \InvalidArgumentException('Given page id does not exist.');
            }

            $url = $this->framework->getAdapter(Controller::class)->generateFrontendUrl($jumpTo->row());

            list(, $queryString) = explode('?', Environment::get('request'), 2);

            if ('' != $queryString) {
                $url .= '?'.$queryString;
            }
        }

        $url = ampersand($url, false);

        return $url;
    }
protected function prepareUrl ( $ url ) { if ( null === $ url ) { $ url = Environment :: get ( 'requestUri' ) ; } elseif ( is_numeric ( $ url ) ) { if ( null === ( $ jumpTo = $ this -> framework -> getAdapter ( PageModel :: class ) -> findByPk ( $ url ) ) ) { throw new \ InvalidArgumentException ( 'Given page id does not exist.' ) ; } $ url = $ this -> framework -> getAdapter ( Controller :: class ) -> generateFrontendUrl ( $ jumpTo -> row ( ) ) ; list ( , $ queryString ) = explode ( '?' , Environment :: get ( 'request' ) , 2 ) ; if ( '' != $ queryString ) { $ url .= '?' . $ queryString ; } } $ url = ampersand ( $ url , false ) ; return $ url ; }
Prepare URL from ID and keep query string from current string.

@param string|int|null

@return string
Prepare URL from ID and keep query string from current string .