TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
recordlist/Classes/LinkHandler/FolderLinkHandler.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Recordlist\LinkHandler;
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  } else {
60  return [];
61  }
62  }
63 
72  protected function renderItem(ResourceInterface $fileOrFolderObject)
73  {
74  if (!$fileOrFolderObject instanceof Folder) {
75  throw new \InvalidArgumentException('Expected Folder object, got "' . get_class($fileOrFolderObject) . '" object.', 1443651369);
76  }
77  $overlay = null;
78  if ($fileOrFolderObject instanceof InaccessibleFolder) {
79  $overlay = ['status-overlay-locked' => []];
80  }
81  return [
82  'icon' => $this->iconFactory->getIcon('apps-filetree-folder-default', Icon::SIZE_SMALL, $overlay)->render(),
83  'identifier' => $fileOrFolderObject->getCombinedIdentifier(),
84  'name' => $fileOrFolderObject->getName(),
85  'url' => GeneralUtility::makeInstance(LinkService::class)->asString(['type' => LinkService::TYPE_FOLDER, 'folder' => $fileOrFolderObject]),
86  'title' => GeneralUtility::fixed_lgd_cs($fileOrFolderObject->getName(), (int)$this->getBackendUser()->uc['titleLen'])
87  ];
88  }
89 }
getSubfolders($start=0, $numberOfItems=0, $filterMode=self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $recursive=false)
static makeInstance($className,...$constructorArguments)