public function getAvailableSitesSelector(
        $selectorName,
        Site $selectedSite = null
    ) {
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);

        $sites = $siteRepository->getAvailableSites();
        $selector = '<select name="' . htmlspecialchars($selectorName) . '" class="form-control">';

        foreach ($sites as $site) {
            $selectedAttribute = '';
            if ($selectedSite !== null && $site->getRootPageId() === $selectedSite->getRootPageId()) {
                $selectedAttribute = ' selected="selected"';
            }

            $selector .= '<option value="' . htmlspecialchars($site->getRootPageId()) . '"' . $selectedAttribute . '>'
                . htmlspecialchars($site->getLabel())
                . '</option>';
        }

        $selector .= '</select>';

        return $selector;
    }
public function getAvailableSitesSelector(
        $selectorName,
        Site $selectedSite = null
    ) {
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);

        $sites = $siteRepository->getAvailableSites();
        $selector = '<select name="' . htmlspecialchars($selectorName) . '" class="form-control">';

        foreach ($sites as $site) {
            $selectedAttribute = '';
            if ($selectedSite !== null && $site->getRootPageId() === $selectedSite->getRootPageId()) {
                $selectedAttribute = ' selected="selected"';
            }

            $selector .= '<option value="' . htmlspecialchars($site->getRootPageId()) . '"' . $selectedAttribute . '>'
                . htmlspecialchars($site->getLabel())
                . '</option>';
        }

        $selector .= '</select>';

        return $selector;
    }
public function getAvailableSitesSelector ( $ selectorName , Site $ selectedSite = null ) { $ siteRepository = GeneralUtility :: makeInstance ( SiteRepository :: class ) ; $ sites = $ siteRepository -> getAvailableSites ( ) ; $ selector = '<select name="' . htmlspecialchars ( $ selectorName ) . '" class="form-control">' ; foreach ( $ sites as $ site ) { $ selectedAttribute = '' ; if ( $ selectedSite !== null && $ site -> getRootPageId ( ) === $ selectedSite -> getRootPageId ( ) ) { $ selectedAttribute = ' selected="selected"' ; } $ selector .= '<option value="' . htmlspecialchars ( $ site -> getRootPageId ( ) ) . '"' . $ selectedAttribute . '>' . htmlspecialchars ( $ site -> getLabel ( ) ) . '</option>' ; } $ selector .= '</select>' ; return $ selector ; }
Creates a dropdown selector of available TYPO3 sites with Solr configured.

@param string $selectorName Name to be used in the select's name attribute
@param Site $selectedSite Optional, currently selected site
@return string Site selector HTML code
Creates a dropdown selector of available TYPO3 sites with Solr configured .