[FEATURE] Show only sys_languages in Backend which are available
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Site / Entity / SiteInterface.php
1 <?php
2 declare(strict_types = 1);
3
4 namespace TYPO3\CMS\Core\Site\Entity;
5
6 /*
7 * This file is part of the TYPO3 CMS project.
8 *
9 * It is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, either version 2
11 * of the License, or any later version.
12 *
13 * For the full copyright and license information, please read the
14 * LICENSE.txt file that was distributed with this source code.
15 *
16 * The TYPO3 project - inspiring people to share!
17 */
18
19 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
20 use TYPO3\CMS\Core\Error\PageErrorHandler\PageErrorHandlerInterface;
21 use TYPO3\CMS\Core\Error\PageErrorHandler\PageErrorHandlerNotConfiguredException;
22
23 interface SiteInterface
24 {
25 /**
26 * Returns the root page ID of this site
27 *
28 * @return int
29 */
30 public function getRootPageId(): int;
31
32 /**
33 * Returns all available languages of this site visible in the frontend
34 *
35 * @return SiteLanguage[]
36 */
37 public function getLanguages(): array;
38
39 /**
40 * Returns a language of this site, given by the sys_language_uid
41 *
42 * @param int $languageId
43 * @return SiteLanguage
44 * @throws \InvalidArgumentException
45 */
46 public function getLanguageById(int $languageId): SiteLanguage;
47
48 /**
49 * Returns the first language that was configured. This is usually language=0
50 *
51 * @return SiteLanguage
52 */
53 public function getDefaultLanguage(): SiteLanguage;
54
55 /**
56 * Fetch the available languages for a specific backend user, used in various places in Backend and Frontend
57 * when a Backend User is authenticated.
58 *
59 * @param BackendUserAuthentication $user the authenticated backend user to check access rights
60 * @param bool $includeAllLanguagesFlag whether "-1" should be included in the values or not.
61 * @param int $pageId usually used for resolving additional information from PageTS, only used for pseudo-sites. uid of the default language row!
62 * @return SiteLanguage[]
63 */
64 public function getAvailableLanguages(BackendUserAuthentication $user, bool $includeAllLanguagesFlag = false, int $pageId = null): array;
65
66 /**
67 * Returns a ready-to-use error handler, to be used within the ErrorController
68 *
69 * @param int $statusCode
70 * @return PageErrorHandlerInterface
71 * @throws PageErrorHandlerNotConfiguredException
72 */
73 public function getErrorHandler(int $statusCode): PageErrorHandlerInterface;
74 }