‪TYPO3CMS  10.4
TYPO3\CMS\Core\Site\SiteFinder Class Reference

Public Member Functions

 __construct (SiteConfiguration $siteConfiguration=null)
 
Site[] getAllSites (bool $useCache=true)
 
Site getSiteByRootPageId (int $rootPageId)
 
Site getSiteByIdentifier (string $identifier)
 
Site getSiteByPageId (int $pageId, array $rootLine=null, string $mountPointParameter=null)
 

Protected Member Functions

 fetchAllSites (bool $useCache=true)
 

Protected Attributes

Site[] $sites = array( )
 
array $mappingRootPageIdToIdentifier = array( )
 
SiteConfiguration $siteConfiguration
 

Detailed Description

Is used in backend and frontend for all places where to read / identify sites and site languages.

Definition at line 30 of file SiteFinder.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Site\SiteFinder::__construct ( SiteConfiguration  $siteConfiguration = null)

Fetches all existing configurations as Site objects

Parameters
SiteConfiguration$siteConfiguration

Definition at line 51 of file SiteFinder.php.

References TYPO3\CMS\Core\Site\SiteFinder\$siteConfiguration, and TYPO3\CMS\Core\Site\SiteFinder\fetchAllSites().

Member Function Documentation

◆ fetchAllSites()

TYPO3\CMS\Core\Site\SiteFinder::fetchAllSites ( bool  $useCache = true)
protected
Parameters
bool$useCache

Definition at line 138 of file SiteFinder.php.

Referenced by TYPO3\CMS\Core\Site\SiteFinder\__construct(), and TYPO3\CMS\Core\Site\SiteFinder\getAllSites().

◆ getAllSites()

Site [] TYPO3\CMS\Core\Site\SiteFinder::getAllSites ( bool  $useCache = true)

Return a list of all configured sites

Parameters
bool$useCache
Returns
Site[]

Definition at line 63 of file SiteFinder.php.

References TYPO3\CMS\Core\Site\SiteFinder\$sites, and TYPO3\CMS\Core\Site\SiteFinder\fetchAllSites().

◆ getSiteByIdentifier()

Site TYPO3\CMS\Core\Site\SiteFinder::getSiteByIdentifier ( string  $identifier)

Find a site by given identifier

Parameters
string$identifier
Returns
Site
Exceptions
SiteNotFoundException

Definition at line 94 of file SiteFinder.php.

◆ getSiteByPageId()

Site TYPO3\CMS\Core\Site\SiteFinder::getSiteByPageId ( int  $pageId,
array  $rootLine = null,
string  $mountPointParameter = null 
)

Traverses the rootline of a page up until a Site was found.

Parameters
int$pageId
array$rootLine
string | null$mountPointParameter
Returns
Site
Exceptions
SiteNotFoundException

Definition at line 111 of file SiteFinder.php.

Referenced by TYPO3\CMS\Frontend\DataProcessing\SiteProcessor\getCurrentSite().

◆ getSiteByRootPageId()

Site TYPO3\CMS\Core\Site\SiteFinder::getSiteByRootPageId ( int  $rootPageId)

Find a site by given root page id

Parameters
int$rootPageId‪the page ID (default language)
Returns
Site
Exceptions
SiteNotFoundException

only for usage in some places for managing Site Configuration, might be removed without further notice

Definition at line 79 of file SiteFinder.php.

Referenced by TYPO3\CMS\Backend\Form\FormDataProvider\SiteDatabaseEditRow\getRawConfigurationForSiteWithRootPageId().

Member Data Documentation

◆ $mappingRootPageIdToIdentifier

array TYPO3\CMS\Core\Site\SiteFinder::$mappingRootPageIdToIdentifier = array( )
protected

Short-hand to quickly fetch a site based on a rootPageId

Definition at line 40 of file SiteFinder.php.

◆ $siteConfiguration

SiteConfiguration TYPO3\CMS\Core\Site\SiteFinder::$siteConfiguration
protected

Definition at line 44 of file SiteFinder.php.

Referenced by TYPO3\CMS\Core\Site\SiteFinder\__construct().

◆ $sites

Site [] TYPO3\CMS\Core\Site\SiteFinder::$sites = array( )
protected

Definition at line 34 of file SiteFinder.php.

Referenced by TYPO3\CMS\Core\Site\SiteFinder\getAllSites().