Site implements SiteInterface

Entity representing a single site with available languages

Tags
phpstan-type

LanguageRef -1|0|positive-int

Table of Contents

Interfaces

SiteInterface

Constants

ERRORHANDLER_TYPE_FLUID  = 'Fluid'
ERRORHANDLER_TYPE_LOGIN_REDIRECT  = 'LoginRedirect'
ERRORHANDLER_TYPE_PAGE  = 'Page'
ERRORHANDLER_TYPE_PHP  = 'PHP'

Properties

$invalidSets  : array<string, SetError, name: string, context: string}>
$base  : UriInterface
$configuration  : array<string|int, mixed>
Any attributes for this site
$errorHandlers  : array<string|int, mixed>
$identifier  : string
$languages  : mixed
$rawConfiguration  : array<string|int, mixed>
Raw attributes for this site
$rootPageId  : int
$sets  : array<int, string>
$settings  : SiteSettings
$tsConfig  : SiteTSconfig|null
$typoscript  : SiteTypoScript|null

Methods

__construct()  : mixed
Sets up a site object, and its languages, error handlers and the settings
getAllLanguages()  : array<string|int, mixed>
Returns all available languages of this site, even the ones disabled for frontend usages
getAttribute()  : mixed
Returns a single configuration attribute
getAvailableLanguages()  : array<string|int, SiteLanguage>
Fetch the available languages for a specific backend user, used in various places in Backend and Frontend when a Backend User is authenticated.
getBase()  : UriInterface
Returns the base URL of this site
getConfiguration()  : array<string|int, mixed>
Returns the whole configuration for this site
getDefaultLanguage()  : SiteLanguage
Returns the first language that was configured. This is usually language=0
getErrorHandler()  : PageErrorHandlerInterface
Returns a ready-to-use error handler, to be used within the ErrorController
getIdentifier()  : string
Gets the identifier of this site, mainly used when maintaining / configuring sites.
getLanguageById()  : SiteLanguage
Returns a language of this site, given by the sys_language_uid
getLanguages()  : array<string|int, SiteLanguage>
Returns all available languages of this site
getRawConfiguration()  : array<string|int, mixed>
getRootPageId()  : int
Returns the root page ID of this site
getRouter()  : RouterInterface
Returns the applicable router for this site. This might be configurable in the future.
getSets()  : array<int, string>
Returns configured sets of this site
getSettings()  : SiteSettings
getTSconfig()  : SiteTSconfig|null
getTypoScript()  : SiteTypoScript|null
isTypoScriptRoot()  : bool
getLanguageService()  : LanguageService
resolveBaseWithVariants()  : string
Checks if the base has variants, and takes the first variant which matches an expression.
sanitizeBaseUrl()  : string
If a site base contains "/" or "www.domain.com", it is ensured that parse_url() can handle this kind of configuration properly.

Constants

ERRORHANDLER_TYPE_FLUID

protected mixed ERRORHANDLER_TYPE_FLUID = 'Fluid'

ERRORHANDLER_TYPE_LOGIN_REDIRECT

protected mixed ERRORHANDLER_TYPE_LOGIN_REDIRECT = 'LoginRedirect'

ERRORHANDLER_TYPE_PAGE

protected mixed ERRORHANDLER_TYPE_PAGE = 'Page'

ERRORHANDLER_TYPE_PHP

protected mixed ERRORHANDLER_TYPE_PHP = 'PHP'

Properties

$invalidSets

public array<string, SetError, name: string, context: string}> $invalidSets = []

$configuration

Any attributes for this site

protected array<string|int, mixed> $configuration

$errorHandlers

protected array<string|int, mixed> $errorHandlers

$rawConfiguration

Raw attributes for this site

protected array<string|int, mixed> $rawConfiguration

Methods

__construct()

Sets up a site object, and its languages, error handlers and the settings

public __construct(string $identifier, int $rootPageId, array<string|int, mixed> $configuration[, SiteSettings|null $settings = null ][, SiteTypoScript|null $typoscript = null ][, SiteTSconfig|null $tsConfig = null ]) : mixed
Parameters
$identifier : string
$rootPageId : int
$configuration : array<string|int, mixed>
$settings : SiteSettings|null = null
$typoscript : SiteTypoScript|null = null
$tsConfig : SiteTSconfig|null = null

getAllLanguages()

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

public getAllLanguages() : array<string|int, mixed>
Return values
array<string|int, mixed>

getAttribute()

Returns a single configuration attribute

public getAttribute(string $attributeName) : mixed
Parameters
$attributeName : string
Tags
throws
InvalidArgumentException

getAvailableLanguages()

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

public getAvailableLanguages(BackendUserAuthentication $user[, bool $includeAllLanguagesFlag = false ][, int|null $pageId = null ]) : array<string|int, SiteLanguage>
Parameters
$user : BackendUserAuthentication

the authenticated backend user to check access rights

$includeAllLanguagesFlag : bool = false

whether "-1" should be included in the values or not.

$pageId : int|null = null

usually used for resolving additional information from PageTS, only used for pseudo-sites. uid of the default language row!

Return values
array<string|int, SiteLanguage>

getBase()

Returns the base URL of this site

public getBase() : UriInterface
Return values
UriInterface

getConfiguration()

Returns the whole configuration for this site

public getConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDefaultLanguage()

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

public getDefaultLanguage() : SiteLanguage
Return values
SiteLanguage

getIdentifier()

Gets the identifier of this site, mainly used when maintaining / configuring sites.

public getIdentifier() : string
Return values
string

getLanguageById()

Returns a language of this site, given by the sys_language_uid

public getLanguageById(int $languageId) : SiteLanguage
Parameters
$languageId : int
Tags
throws
InvalidArgumentException
Return values
SiteLanguage

getRawConfiguration()

public getRawConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRootPageId()

Returns the root page ID of this site

public getRootPageId() : int
Return values
int

getSets()

Returns configured sets of this site

public getSets() : array<int, string>
Return values
array<int, string>

isTypoScriptRoot()

public isTypoScriptRoot() : bool
Internal
Return values
bool

resolveBaseWithVariants()

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

protected resolveBaseWithVariants(string $baseUrl, array<string|int, mixed>|null $baseVariants) : string
Parameters
$baseUrl : string
$baseVariants : array<string|int, mixed>|null
Return values
string

sanitizeBaseUrl()

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

protected sanitizeBaseUrl(string $base) : string
Parameters
$base : string
Return values
string

        
On this page

Search results