Site¶
The site
request attribute hold information about the current
site in the object \TYPO3\CMS\Core\Site\Entity\Site
.
It is available in frontend and backend context.
Example:
$site = $request->getAttribute('site');
$siteConfiguration = $site->getConfiguration();
Note
In backend context the attribute can hold a
\TYPO3\CMS\Core\Site\Entity\NullSite
object when the module does not
provide a page tree or no page in the page tree is selected.
API¶
- class \TYPO3\CMS\Core\Site\Entity\ Site
-
Entity representing a single site with available languages
- getIdentifier ( )
-
Gets the identifier of this site, mainly used when maintaining / configuring sites.
- returntype
-
string
- getBase ( )
-
Returns the base URL of this site
- returntype
-
Psr\Http\Message\UriInterface
- getRootPageId ( )
-
Returns the root page ID of this site
- returntype
-
int
- getLanguages ( )
-
- returntype
-
array
- getAllLanguages ( )
-
- returntype
-
array
- getLanguageById ( int $languageId)
-
Returns a language of this site, given by the sys_language_uid
- param int $languageId
-
the languageId
- returntype
-
TYPO3\CMS\Core\Site\Entity\SiteLanguage
- getDefaultLanguage ( )
-
- returntype
-
TYPO3\CMS\Core\Site\Entity\SiteLanguage
- getAvailableLanguages ( TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication $user, bool $includeAllLanguagesFlag = false, int $pageId = NULL)
-
- param TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication $user
-
the user
- param bool $includeAllLanguagesFlag
-
the includeAllLanguagesFlag, default: false
- param int $pageId
-
the pageId, default: NULL
- returntype
-
array
- getErrorHandler ( int $statusCode)
-
Returns a ready-to-use error handler, to be used within the ErrorController
- param int $statusCode
-
the statusCode
- returntype
-
TYPO3\CMS\Core\Error\PageErrorHandler\PageErrorHandlerInterface
- getConfiguration ( )
-
Returns the whole configuration for this site
- returntype
-
array
- getAttribute ( string $attributeName)
-
Returns a single configuration attribute
- param string $attributeName
-
the attributeName
- getRouter ( TYPO3\\CMS\\Core\\Context\\Context $context = NULL)
-
Returns the applicable router for this site. This might be configurable in the future.
- param TYPO3\\CMS\\Core\\Context\\Context $context
-
the context, default: NULL
- returntype
-
TYPO3\CMS\Core\Routing\RouterInterface