‪TYPO3CMS  10.4
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

 __construct (string $identifier, int $rootPageId, array $configuration)
 
string getIdentifier ()
 
UriInterface getBase ()
 
int getRootPageId ()
 
SiteLanguage[] getLanguages ()
 
SiteLanguage[] getAllLanguages ()
 
SiteLanguage getLanguageById (int $languageId)
 
 getDefaultLanguage ()
 
 getAvailableLanguages (BackendUserAuthentication $user, bool $includeAllLanguagesFlag=false, int $pageId=null)
 
PageErrorHandlerInterface getErrorHandler (int $statusCode)
 
array getConfiguration ()
 
mixed getAttribute (string $attributeName)
 
RouterInterface getRouter (Context $context=null)
 

Protected Member Functions

string resolveBaseWithVariants (string $baseUrl, ?array $baseVariants)
 
string sanitizeBaseUrl (string $base)
 
LanguageService 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
 
SiteLanguage[] $languages
 
array $errorHandlers
 

Detailed Description

Entity representing a single site with available languages

Definition at line 39 of file Site.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Site\Entity\Site::__construct ( string  $identifier,
int  $rootPageId,
array  $configuration 
)

Member Function Documentation

◆ getAllLanguages()

SiteLanguage [] TYPO3\CMS\Core\Site\Entity\Site::getAllLanguages ( )

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

Returns
SiteLanguage[]

Definition at line 223 of file Site.php.

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

◆ getAttribute()

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

Returns a single configuration attribute

Parameters
string$attributeName
Returns
‪mixed
Exceptions

Definition at line 323 of file Site.php.

◆ getAvailableLanguages()

TYPO3\CMS\Core\Site\Entity\Site::getAvailableLanguages ( BackendUserAuthentication  $user,
bool  $includeAllLanguagesFlag = false,
int  $pageId = null 
)

‪Fetch the available languages for a specific backend user, used in various places in Backend and Frontend when a Backend User is authenticated.

Parameters
BackendUserAuthentication$user‪the authenticated backend user to check access rights
bool$includeAllLanguagesFlag‪whether "-1" should be included in the values or not.
int$pageId‪usually used for resolving additional information from PageTS, only used for pseudo-sites. uid of the default language row!
Returns
SiteLanguage[]

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

Definition at line 257 of file Site.php.

References TYPO3\CMS\Core\Authentication\BackendUserAuthentication\checkLanguageAccess(), TYPO3\CMS\Core\Site\Entity\Site\getBase(), and TYPO3\CMS\Core\Site\Entity\Site\getLanguageService().

◆ getBase()

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

◆ getConfiguration()

array TYPO3\CMS\Core\Site\Entity\Site::getConfiguration ( )

◆ getDefaultLanguage()

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

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

Returns
SiteLanguage

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

Definition at line 249 of file Site.php.

◆ getErrorHandler()

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

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

Parameters
int$statusCode
Returns
‪PageErrorHandlerInterface
Exceptions
PageErrorHandlerNotConfiguredException
InvalidPageErrorHandlerException

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

Definition at line 287 of file Site.php.

References 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()

string TYPO3\CMS\Core\Site\Entity\Site::getIdentifier ( )

◆ getLanguageById()

SiteLanguage TYPO3\CMS\Core\Site\Entity\Site::getLanguageById ( int  $languageId)

◆ getLanguages()

SiteLanguage [] TYPO3\CMS\Core\Site\Entity\Site::getLanguages ( )

Returns all available languages of this site

Returns
SiteLanguage[]

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

Definition at line 207 of file Site.php.

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

Referenced by TYPO3\CMS\Redirects\Service\IntegrityService\getAllPageUrlsForSite().

◆ getLanguageService()

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

Shorthand functionality for fetching the language service

Returns
‪LanguageService

Definition at line 374 of file Site.php.

References $GLOBALS.

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

◆ getRootPageId()

◆ getRouter()

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

Returns the applicable router for this site. This might be configurable in the future.

Parameters
Context | null$context
Returns
‪RouterInterface

Definition at line 365 of file Site.php.

Referenced by TYPO3\CMS\Frontend\Typolink\PageLinkBuilder\generateUrlForPageWithSiteConfiguration(), and TYPO3\CMS\Frontend\Middleware\StaticRouteResolver\getPageUri().

◆ resolveBaseWithVariants()

string 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.

Parameters
string$baseUrl
array | null$baseVariants
Returns
‪string

Definition at line 148 of file Site.php.

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

◆ sanitizeBaseUrl()

string 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.

Parameters
string$base
Returns
‪string

Definition at line 341 of file Site.php.

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

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

Member Data Documentation

◆ $base

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

◆ $configuration

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

Any attributes for this site

Definition at line 60 of file Site.php.

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

◆ $errorHandlers

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

Definition at line 68 of file Site.php.

◆ $identifier

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

◆ $languages

SiteLanguage [] TYPO3\CMS\Core\Site\Entity\Site::$languages
protected

◆ $rootPageId

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

◆ ERRORHANDLER_TYPE_FLUID

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

Definition at line 42 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 41 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 43 of file Site.php.

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