‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Site\Entity\Site Class Reference
Inheritance diagram for TYPO3\CMS\Core\Site\Entity\Site:
TYPO3\CMS\Core\Site\Entity\SiteInterface

Public Member Functions

 getIdentifier ()
 
 getBase ()
 
 getRootPageId ()
 
 getLanguageById (int $languageId)
 
 getDefaultLanguage ()
 
array< LanguageRef, getAvailableLanguages(BackendUserAuthentication $user, bool $includeAllLanguagesFlag=false, int $pageId=null):array { $availableLanguages=[];if( $includeAllLanguagesFlag &&$user->checkLanguageAccess(-1)) { $availableLanguages[-1]=new SiteLanguage(-1, '', $this->getBase(),['title'=> $this->getLanguageService() ->sL( 'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:multipleLanguages'), 'flag'=> 'flags-multiple',]);} foreach( $this->languages as $language) { if( $user->checkLanguageAccess( $language)) { $availableLanguages[ $language-> getLanguageId ()]
 
 getErrorHandler (int $statusCode)
 
 getConfiguration ()
 
 getSettings ()
 
 isTypoScriptRoot ()
 
 getTypoScript ()
 
 getTSconfig ()
 
mixed getAttribute (string $attributeName)
 
 getRouter (Context $context=null)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Site\Entity\SiteInterface
SiteLanguage[] getLanguages ()
 
SiteLanguage[] getAvailableLanguages (BackendUserAuthentication $user, bool $includeAllLanguagesFlag=false, int $pageId=null)
 

Public Attributes

$this rootPageId = $rootPageId
 
if($settings===null) $this settings = $settings
 
$this typoscript = $typoscript
 
$this tsConfig = $tsConfig
 
 $configuration ['settings'] = $this->settings->getAll()
 
$this configuration = $configuration
 
 $baseUrl
 
$this base = new Uri($this->sanitizeBaseUrl($baseUrl))
 
$this sets = $configuration['dependencies'] ?? []
 
array< LanguageRef, function getLanguages():array { $languages=[];foreach( $this->languages as $languageId=> $language) { if( $language->enabled()) { $languages[ $languageId]=$language;} } return $languages;} public list< string > function getSets():array { return $this-> sets
 
array< LanguageRef, function getAllLanguages():array { return $this-> languages
 
return $availableLanguages
 

Protected Member Functions

foreach($configuration['languages'] as $languageConfiguration) foreach($configuration['errorHandling'] ??[] as $errorHandlingConfiguration) resolveBaseWithVariants (string $baseUrl, ?array $baseVariants)
 
 sanitizeBaseUrl (string $base)
 
 getLanguageService ()
 

Protected Attributes

const ERRORHANDLER_TYPE_PAGE = 'Page'
 
const ERRORHANDLER_TYPE_FLUID = 'Fluid'
 
const ERRORHANDLER_TYPE_PHP = 'PHP'
 
string $identifier
 
UriInterface $base
 
int $rootPageId
 
array $configuration
 
array< LanguageRef, $languages;protected array $sets;protected array $errorHandlers;protected SiteSettings $settings;protected ?SiteTypoScript $typoscript;protected ?SiteTSconfig $tsConfig;public function __construct(string $identifier, int $rootPageId, array $configuration, SiteSettings $settings=null, ?SiteTypoScript $typoscript=null, ?SiteTSconfig $tsConfig=null) { $this-> identifier = $identifier
 

Detailed Description

Entity representing a single site with available languages

@phpstan-type LanguageRef -1|0|positive-int

Definition at line 41 of file Site.php.

Member Function Documentation

◆ getAttribute()

mixed TYPO3\CMS\Core\Site\Entity\Site::getAttribute ( string  $attributeName)

Returns a single configuration attribute

Returns
‪mixed
Exceptions

Definition at line 353 of file Site.php.

References TYPO3\CMS\Core\Site\Entity\Site\configuration, and TYPO3\CMS\Core\Site\Entity\Site\identifier.

Referenced by TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\getCurrentSite().

◆ getBase()

TYPO3\CMS\Core\Site\Entity\Site::getBase ( )

◆ getConfiguration()

◆ getDefaultLanguage()

TYPO3\CMS\Core\Site\Entity\Site::getDefaultLanguage ( )

Returns the first language that was configured. This is usually language=0

Implements TYPO3\CMS\Core\Site\Entity\SiteInterface.

Definition at line 258 of file Site.php.

References TYPO3\CMS\Core\Site\Entity\Site\languages.

◆ getErrorHandler()

TYPO3\CMS\Core\Site\Entity\Site::getErrorHandler ( int  $statusCode)

Returns a ready-to-use error handler, to be used within the ErrorController

Exceptions
PageErrorHandlerNotConfiguredException
InvalidPageErrorHandlerException

Implements TYPO3\CMS\Core\Site\Entity\SiteInterface.

Definition at line 294 of file Site.php.

References TYPO3\CMS\Redirects\Message\$statusCode, TYPO3\CMS\Core\Site\Entity\Site\ERRORHANDLER_TYPE_FLUID, TYPO3\CMS\Core\Site\Entity\Site\ERRORHANDLER_TYPE_PAGE, and TYPO3\CMS\Core\Site\Entity\Site\ERRORHANDLER_TYPE_PHP.

◆ getIdentifier()

◆ getLanguageById()

◆ getLanguageId()

array<LanguageRef, getAvailableLanguages(BackendUserAuthentication $user, bool $includeAllLanguagesFlag = false, int $pageId = null): array { $availableLanguages = []; if ($includeAllLanguagesFlag && $user->checkLanguageAccess(-1)) { $availableLanguages[-1] = new SiteLanguage(-1, '', $this->getBase(), [ 'title' => $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:multipleLanguages'), 'flag' => 'flags-multiple', ]); } foreach ($this->languages as $language) { if ($user->checkLanguageAccess($language)) { $availableLanguages[$language-> TYPO3\CMS\Core\Site\Entity\Site::getLanguageId ( )
Returns
‪array<LanguageRef, SiteLanguage>

◆ getLanguageService()

TYPO3\CMS\Core\Site\Entity\Site::getLanguageService ( )
protected

Definition at line 394 of file Site.php.

References $GLOBALS.

◆ getRootPageId()

◆ getRouter()

TYPO3\CMS\Core\Site\Entity\Site::getRouter ( Context  $context = null)

◆ getSettings()

◆ getTSconfig()

TYPO3\CMS\Core\Site\Entity\Site::getTSconfig ( )

Definition at line 342 of file Site.php.

◆ getTypoScript()

TYPO3\CMS\Core\Site\Entity\Site::getTypoScript ( )

◆ isTypoScriptRoot()

◆ resolveBaseWithVariants()

foreach ( $configuration[ 'languages'] as $languageConfiguration) foreach ( $configuration[ 'errorHandling'] ??[] as $errorHandlingConfiguration) TYPO3\CMS\Core\Site\Entity\Site::resolveBaseWithVariants ( string  $baseUrl,
?array  $baseVariants 
)
protected

Checks if the base has variants, and takes the first variant which matches an expression.

Definition at line 158 of file Site.php.

References TYPO3\CMS\Core\Site\Entity\Site\$baseUrl.

◆ sanitizeBaseUrl()

TYPO3\CMS\Core\Site\Entity\Site::sanitizeBaseUrl ( string  $base)
protected

If a site base contains "/" or "www.domain.com", it is ensured that parse_url() can handle this kind of configuration properly.

Definition at line 368 of file Site.php.

References TYPO3\CMS\Core\Site\Entity\Site\$base.

Member Data Documentation

◆ $availableLanguages

return TYPO3\CMS\Core\Site\Entity\Site::$availableLanguages

Definition at line 285 of file Site.php.

◆ $base

UriInterface TYPO3\CMS\Core\Site\Entity\Site::$base
protected

◆ $baseUrl

TYPO3\CMS\Core\Site\Entity\Site::$baseUrl
Initial value:
‪$configuration['base'] ?? '',
‪$configuration['baseVariants'] ?? null
)

Definition at line 108 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\resolveBaseWithVariants().

◆ $configuration [1/2]

array TYPO3\CMS\Core\Site\Entity\Site::$configuration
protected

Any attributes for this site

Definition at line 62 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\getConfiguration().

◆ $configuration [2/2]

TYPO3\CMS\Core\Site\Entity\Site::$configuration[ 'languages'] = $this->settings->getAll()

Definition at line 97 of file Site.php.

◆ $identifier

string TYPO3\CMS\Core\Site\Entity\Site::$identifier
protected

Definition at line 49 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\getIdentifier().

◆ $rootPageId

int TYPO3\CMS\Core\Site\Entity\Site::$rootPageId
protected

Definition at line 57 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\getRootPageId().

◆ base

$this TYPO3\CMS\Core\Site\Entity\Site::base = new Uri($this->sanitizeBaseUrl($baseUrl))

Definition at line 112 of file Site.php.

◆ configuration

$this TYPO3\CMS\Core\Site\Entity\Site::configuration = $configuration

Definition at line 98 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\getAttribute().

◆ ERRORHANDLER_TYPE_FLUID

const TYPO3\CMS\Core\Site\Entity\Site::ERRORHANDLER_TYPE_FLUID = 'Fluid'
protected

Definition at line 44 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\getErrorHandler().

◆ ERRORHANDLER_TYPE_PAGE

const TYPO3\CMS\Core\Site\Entity\Site::ERRORHANDLER_TYPE_PAGE = 'Page'
protected

Definition at line 43 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\getErrorHandler().

◆ ERRORHANDLER_TYPE_PHP

const TYPO3\CMS\Core\Site\Entity\Site::ERRORHANDLER_TYPE_PHP = 'PHP'
protected

Definition at line 45 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\getErrorHandler().

◆ identifier

array<LanguageRef, $languages; protected array $sets; protected array $errorHandlers; protected SiteSettings $settings; protected ?SiteTypoScript $typoscript; protected ?SiteTSconfig $tsConfig; public function __construct(string $identifier, int $rootPageId, array $configuration, SiteSettings $settings = null, ?SiteTypoScript $typoscript = null, ?SiteTSconfig $tsConfig = null) { $this-> TYPO3\CMS\Core\Site\Entity\Site::identifier = $identifier
protected

◆ languages

array<LanguageRef, function getAllLanguages(): array { return $this-> TYPO3\CMS\Core\Site\Entity\Site::languages

Returns all available languages of this site, even the ones disabled for frontend usages

Returns
‪array<LanguageRef, SiteLanguage>

Definition at line 239 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\getDefaultLanguage(), and TYPO3\CMS\Core\Site\Entity\Site\getLanguageById().

◆ rootPageId

$this TYPO3\CMS\Core\Site\Entity\Site::rootPageId = $rootPageId

Definition at line 89 of file Site.php.

◆ sets [1/2]

$this TYPO3\CMS\Core\Site\Entity\Site::sets = $configuration['dependencies'] ?? []

Definition at line 114 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\isTypoScriptRoot().

◆ sets [2/2]

array<LanguageRef, function getLanguages(): array { $languages = []; foreach ($this->languages as $languageId => $language) { if ($language->enabled()) { $languages[$languageId] = $language; } } return $languages; } public list<string> function getSets(): array { return $this-> TYPO3\CMS\Core\Site\Entity\Site::sets

Returns all available languages of this site

Returns
‪array<LanguageRef, SiteLanguage>

Definition at line 229 of file Site.php.

◆ settings

if ( $settings===null) $this TYPO3\CMS\Core\Site\Entity\Site::settings = $settings

Definition at line 93 of file Site.php.

◆ tsConfig

$this TYPO3\CMS\Core\Site\Entity\Site::tsConfig = $tsConfig

Definition at line 95 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\isTypoScriptRoot().

◆ typoscript

$this TYPO3\CMS\Core\Site\Entity\Site::typoscript = $typoscript

Definition at line 94 of file Site.php.

Referenced by TYPO3\CMS\Core\Site\Entity\Site\isTypoScriptRoot().

‪TYPO3\CMS\Core\Site\Entity\Site\resolveBaseWithVariants
‪foreach($configuration['languages'] as $languageConfiguration) foreach($configuration['errorHandling'] ??[] as $errorHandlingConfiguration) resolveBaseWithVariants(string $baseUrl, ?array $baseVariants)
Definition: Site.php:158
‪TYPO3\CMS\Core\Site\Entity\Site\$configuration
‪array $configuration
Definition: Site.php:62