‪TYPO3CMS  10.4
StateUtility.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 
28 {
34  public static function ‪isActivatedForUser(): bool
35  {
36  $beUser = ‪$GLOBALS['BE_USER'] ?? null;
37  if ($beUser instanceof ‪FrontendBackendUserAuthentication) {
38  $adminPanelConfiguration = $beUser->getTSConfig()['admPanel.'] ?? [];
39  if (isset($adminPanelConfiguration['enable.'])) {
40  // only enabled if at least one module is enabled.
41  return (bool)array_filter($adminPanelConfiguration['enable.']);
42  }
43  }
44  return false;
45  }
46 
53  public static function ‪isOpen(): bool
54  {
55  $beUser = ‪$GLOBALS['BE_USER'] ?? null;
56  return (bool)($beUser->uc['AdminPanel']['display_top'] ?? false);
57  }
58 
59  public static function ‪isActivatedInTypoScript(): bool
60  {
61  return (bool)(‪$GLOBALS['TSFE']->config['config']['admPanel'] ?? false);
62  }
63 
64  public static function ‪isHiddenForUser(): bool
65  {
66  $beUser = ‪$GLOBALS['BE_USER'] ?? null;
67  return $beUser ? (bool)($beUser->getTSConfig()['admPanel.']['hide'] ?? false) : false;
68  }
69 }
‪TYPO3\CMS\Adminpanel\Utility\StateUtility\isActivatedForUser
‪static bool isActivatedForUser()
Definition: StateUtility.php:34
‪TYPO3\CMS\Adminpanel\Utility
Definition: MemoryUtility.php:18
‪TYPO3\CMS\Backend\FrontendBackendUserAuthentication
Definition: FrontendBackendUserAuthentication.php:31
‪TYPO3\CMS\Adminpanel\Utility\StateUtility\isHiddenForUser
‪static isHiddenForUser()
Definition: StateUtility.php:64
‪TYPO3\CMS\Adminpanel\Utility\StateUtility
Definition: StateUtility.php:28
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Adminpanel\Utility\StateUtility\isOpen
‪static bool isOpen()
Definition: StateUtility.php:53
‪TYPO3\CMS\Adminpanel\Utility\StateUtility\isActivatedInTypoScript
‪static isActivatedInTypoScript()
Definition: StateUtility.php:59