pageRenderer->loadJavaScriptModule('@typo3/filelist/browse-folders.js');
}
protected function initVariables(ServerRequestInterface $request): void
{
parent::initVariables($request);
$this->resourceDisplayMatcher = GeneralUtility::makeInstance(Matcher::class);
$this->resourceDisplayMatcher->addMatcher(GeneralUtility::makeInstance(ResourceFolderTypeMatcher::class));
$this->resourceSelectableMatcher = GeneralUtility::makeInstance(Matcher::class);
$this->resourceSelectableMatcher->addMatcher(GeneralUtility::makeInstance(ResourceFolderTypeMatcher::class));
}
public function render(): string
{
$this->initSelectedFolder();
$contentHtml = '';
if ($this->selectedFolder instanceof Folder) {
$markup = [];
// Create the filelist
$this->filelist->start(
$this->selectedFolder,
MathUtility::forceIntegerInRange($this->currentPage, 1, 100000),
$this->sortField,
$this->sortDirection,
Mode::BROWSE
);
// Create the filelist header bar
$markup[] = '
';
$markup[] = '
';
$markup[] = '
';
$markup[] = ' ' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.selection')) . '';
$markup[] = ' ';
$markup[] = '
';
$markup[] = '
';
$markup[] = '
';
$markup[] = ' ' . $this->getSortingModeButtons();
$markup[] = ' ' . $this->getViewModeButton();
$markup[] = '
';
$markup[] = '
';
$this->filelist->setResourceDisplayMatcher($this->resourceDisplayMatcher);
$this->filelist->setResourceSelectableMatcher($this->resourceSelectableMatcher);
$markup[] = $this->filelist->render(null, $this->view);
// Build the folder creation form
$resourceUtilityRenderer = GeneralUtility::makeInstance(ResourceUtilityRenderer::class, $this);
$markup[] = $resourceUtilityRenderer->createFolder($this->getRequest(), $this->selectedFolder);
$contentHtml = implode('', $markup);
}
$contentOnly = (bool)($this->getRequest()->getQueryParams()['contentOnly'] ?? false);
$this->pageRenderer->setTitle($this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_browse_links.xlf:folderSelector'));
$this->view->assign('selectedFolder', $this->selectedFolder);
$this->view->assign('content', $contentHtml);
$this->view->assign('contentOnly', $contentOnly);
$content = $this->view->render('ElementBrowser/Folder');
if ($contentOnly) {
return $content;
}
$this->pageRenderer->setBodyContent('getBodyTagParameters() . '>' . $content);
return $this->pageRenderer->render($this->getRequest());
}
}