TYPO3 CMS  TYPO3_8-7
FolderLinkHandler.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
24 
29 {
33  protected $mode = 'folder';
34 
38  protected $expectedClass = Folder::class;
39 
45  protected function getFolderContent(Folder $folder, $extensionList)
46  {
47  return $folder->getSubfolders();
48  }
49 
53  public function getBodyTagAttributes()
54  {
55  if ($this->linkParts['url']['folder'] instanceof $this->expectedClass) {
56  return [
57  'data-current-link' => GeneralUtility::makeInstance(LinkService::class)->asString(['type' => LinkService::TYPE_FOLDER, 'folder' => $this->linkParts['url']['folder']])
58  ];
59  }
60  return [];
61  }
62 
71  protected function renderItem(ResourceInterface $fileOrFolderObject)
72  {
73  if (!$fileOrFolderObject instanceof Folder) {
74  throw new \InvalidArgumentException('Expected Folder object, got "' . get_class($fileOrFolderObject) . '" object.', 1443651369);
75  }
76  $overlay = null;
77  if ($fileOrFolderObject instanceof InaccessibleFolder) {
78  $overlay = ['status-overlay-locked' => []];
79  }
80  return [
81  'icon' => $this->iconFactory->getIcon('apps-filetree-folder-default', Icon::SIZE_SMALL, $overlay)->render(),
82  'identifier' => $fileOrFolderObject->getCombinedIdentifier(),
83  'name' => $fileOrFolderObject->getName(),
84  'url' => GeneralUtility::makeInstance(LinkService::class)->asString(['type' => LinkService::TYPE_FOLDER, 'folder' => $fileOrFolderObject]),
85  'title' => GeneralUtility::fixed_lgd_cs($fileOrFolderObject->getName(), (int)$this->getBackendUser()->uc['titleLen'])
86  ];
87  }
88 }
static makeInstance($className,... $constructorArguments)
getSubfolders($start=0, $numberOfItems=0, $filterMode=self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $recursive=false)
Definition: Folder.php:272
static fixed_lgd_cs($string, $chars, $appendString='...')