‪TYPO3CMS  ‪main
ListUtility.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
21 
26 {
33  public static function resolveSpecialFolderNames(array $folders)
34  {
35  $resolvedFolders = [];
36  foreach ($folders as $folder) {
37  ‪$name = self::resolveSpecialFolderName($folder);
38  $resolvedFolders[‪$name] = $folder;
39  }
40 
41  return $resolvedFolders;
42  }
43 
47  public static function resolveSpecialFolderName(‪Folder $folder): string
48  {
50  $lang = ‪$GLOBALS['LANG'];
51 
52  ‪$name = $folder->‪getName();
53  ‪$role = $folder->‪getRole();
55  $tempName = htmlspecialchars($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_file.xlf:role_folder_' . ‪$role));
56  if (!empty($tempName) && ($tempName !== ‪$name)) {
57  // Set new name and append original name
58  ‪$name = $tempName . ' (' . ‪$name . ')';
59  }
60  }
61 
62  return ‪$name;
63  }
64 }
‪TYPO3\CMS\Core\Resource\FolderInterface\ROLE_DEFAULT
‪const ROLE_DEFAULT
Definition: FolderInterface.php:28
‪TYPO3\CMS\Core\Resource\Utility\ListUtility\$name
‪if($role !==FolderInterface::ROLE_DEFAULT) return $name
Definition: ListUtility.php:54
‪TYPO3\CMS\Core\Resource\Utility\ListUtility\$role
‪$role
Definition: ListUtility.php:53
‪TYPO3\CMS\Core\Resource\Utility
Definition: ListUtility.php:16
‪TYPO3\CMS\Core\Resource\Utility\ListUtility
Definition: ListUtility.php:26
‪TYPO3\CMS\Core\Resource\Folder
Definition: Folder.php:38
‪TYPO3\CMS\Core\Resource\Folder\getName
‪getName()
Definition: Folder.php:89
‪TYPO3\CMS\Core\Resource\Folder\getRole
‪string getRole()
Definition: Folder.php:539
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Resource\FolderInterface
Definition: FolderInterface.php:24
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:46