‪TYPO3CMS  10.4
FolderLinkHandler.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 
25 
31 {
35  protected ‪$mode = 'folder';
36 
40  protected ‪$expectedClass = Folder::class;
41 
47  protected function ‪getFolderContent(‪Folder $folder, $extensionList)
48  {
49  return $folder->‪getSubfolders();
50  }
51 
55  public function ‪getBodyTagAttributes()
56  {
57  if ($this->linkParts['url']['folder'] instanceof $this->expectedClass) {
58  return [
59  'data-current-link' => GeneralUtility::makeInstance(LinkService::class)->asString(['type' => ‪LinkService::TYPE_FOLDER, 'folder' => $this->linkParts['url']['folder']])
60  ];
61  }
62  return [];
63  }
64 
73  protected function ‪renderItem(‪ResourceInterface $fileOrFolderObject)
74  {
75  if (!$fileOrFolderObject instanceof ‪Folder) {
76  throw new \InvalidArgumentException('Expected Folder object, got "' . get_class($fileOrFolderObject) . '" object.', 1443651369);
77  }
78  $overlay = null;
79  if ($fileOrFolderObject instanceof ‪InaccessibleFolder) {
80  $overlay = ['status-overlay-locked' => []];
81  }
82  return [
83  'icon' => $this->iconFactory->getIcon('apps-filetree-folder-default', ‪Icon::SIZE_SMALL, $overlay)->render(),
84  'identifier' => $fileOrFolderObject->getCombinedIdentifier(),
85  'name' => $fileOrFolderObject->‪getName(),
86  'url' => GeneralUtility::makeInstance(LinkService::class)->asString(['type' => ‪LinkService::TYPE_FOLDER, 'folder' => $fileOrFolderObject]),
87  'title' => GeneralUtility::fixed_lgd_cs($fileOrFolderObject->‪getName(), (int)$this->getBackendUser()->uc['titleLen'])
88  ];
89  }
90 }
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:30
‪TYPO3\CMS\Core\Resource\FileInterface
Definition: FileInterface.php:22
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:26
‪TYPO3\CMS\Core\Resource\InaccessibleFolder
Definition: InaccessibleFolder.php:29
‪TYPO3\CMS\Core\Resource\Folder\getSubfolders
‪Folder[] getSubfolders($start=0, $numberOfItems=0, $filterMode=self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $recursive=false)
Definition: Folder.php:290
‪TYPO3\CMS\Core\Resource\Folder
Definition: Folder.php:37
‪TYPO3\CMS\Core\Resource\ResourceInterface\getName
‪string getName()
‪TYPO3\CMS\Core\Resource\ResourceInterface
Definition: ResourceInterface.php:22
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46