‪TYPO3CMS  9.5
StateUtility.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
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 
20 
27 {
33  public static function ‪isActivatedForUser(): bool
34  {
35  $beUser = ‪$GLOBALS['BE_USER'] ?? null;
36  if ($beUser instanceof ‪FrontendBackendUserAuthentication) {
37  $adminPanelConfiguration = $beUser->getTSConfig()['admPanel.'] ?? [];
38  // set legacy config
39  $beUser->extAdminConfig = $adminPanelConfiguration;
40  if (isset($adminPanelConfiguration['enable.'])) {
41  // only enabled if at least one module is enabled.
42  return (bool)array_filter($adminPanelConfiguration['enable.']);
43  }
44  }
45  return false;
46  }
47 
54  public static function ‪isOpen(): bool
55  {
56  $beUser = ‪$GLOBALS['BE_USER'] ?? null;
57  return (bool)($beUser->uc['AdminPanel']['display_top'] ?? false);
58  }
59 
60  public static function ‪isActivatedInTypoScript(): bool
61  {
62  return (bool)(‪$GLOBALS['TSFE']->config['config']['admPanel'] ?? false);
63  }
64 
65  public static function ‪isHiddenForUser(): bool
66  {
67  return (bool)(‪$GLOBALS['BE_USER']->extAdminConfig['hide'] ?? false);
68  }
69 }
‪TYPO3\CMS\Adminpanel\Utility\StateUtility\isActivatedForUser
‪static bool isActivatedForUser()
Definition: StateUtility.php:33
‪TYPO3\CMS\Adminpanel\Utility
Definition: MemoryUtility.php:4
‪TYPO3\CMS\Backend\FrontendBackendUserAuthentication
Definition: FrontendBackendUserAuthentication.php:35
‪TYPO3\CMS\Adminpanel\Utility\StateUtility\isHiddenForUser
‪static isHiddenForUser()
Definition: StateUtility.php:65
‪TYPO3\CMS\Adminpanel\Utility\StateUtility
Definition: StateUtility.php:27
‪$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:54
‪TYPO3\CMS\Adminpanel\Utility\StateUtility\isActivatedInTypoScript
‪static isActivatedInTypoScript()
Definition: StateUtility.php:60