MetaModels\BackendIntegration\SearchablePages::getBaseUrl PHP Method

getBaseUrl() private method

Get the base URL.
private getBaseUrl ( string[] $pageDetails, null | string $path = null, boolean $ignoreSSL = false ) : ContaoCommunityAlliance\UrlBuilder\UrlBuilder
$pageDetails string[] The page details.
$path null | string Additional path settings.
$ignoreSSL boolean If active the system will ignore the 'rootUseSSL' flag.
return ContaoCommunityAlliance\UrlBuilder\UrlBuilder
    private function getBaseUrl($pageDetails, $path = null, $ignoreSSL = false)
    {
        $url = new UrlBuilder();
        // Set the domain (see contao/core#6421)
        if ($pageDetails['domain']) {
            $url->setHost($pageDetails['domain']);
        } else {
            $url->setHost(\Environment::get('host'));
        }
        if ($pageDetails['rootUseSSL'] && !$ignoreSSL) {
            $url->setScheme('https');
        } else {
            $url->setScheme('http');
        }
        // Make a array for the parts.
        $fullPath = array();
        $fullPath[] = TL_PATH;
        // Get the path.
        if ($path === null) {
            $event = new GenerateFrontendUrlEvent($pageDetails, null, $pageDetails['language'], true);
            $this->getEventDispatcher()->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event);
            $fullPath[] = $event->getUrl();
        } else {
            $fullPath[] = $path;
        }
        $url->setPath(implode('/', $fullPath));
        return $url;
    }