[BUGFIX] Make current folder selectable for folder links 52/62852/4
authorMarkus Klein <markus.klein@typo3.org>
Sun, 12 Jan 2020 15:22:56 +0000 (16:22 +0100)
committerDaniel Goerz <daniel.goerz@posteo.de>
Tue, 14 Jan 2020 10:55:36 +0000 (11:55 +0100)
This allows to create a folder link to the currently selected
folder in the folder browser.

Resolves: #72527
Releases: master, 9.5
Change-Id: Ifbbfbd744965f8ca8e78f116ea89e3b9d8396d59
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62852
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Jörg Bösche <typo3@joergboesche.de>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
typo3/sysext/recordlist/Classes/LinkHandler/FileLinkHandler.php
typo3/sysext/recordlist/Resources/Private/Templates/LinkBrowser/Folder.html

index 0415f67..1e8649d 100644 (file)
@@ -151,6 +151,7 @@ class FileLinkHandler extends AbstractLinkHandler implements LinkHandlerInterfac
         $folderIcon = $this->iconFactory->getIconForResource($folder, Icon::SIZE_SMALL)->render();
         $this->view->assign('selectedFolderIcon', $folderIcon);
         $this->view->assign('selectedFolderTitle', GeneralUtility::fixed_lgd_cs($folder->getIdentifier(), (int)$this->getBackendUser()->uc['titleLen']));
+        $this->view->assign('selectedFolderUrl', GeneralUtility::makeInstance(LinkService::class)->asString(['type' => LinkService::TYPE_FOLDER, 'folder' => $folder]));
         if ($this->mode === 'file') {
             $this->view->assign('currentIdentifier', !empty($this->linkParts) ? $this->linkParts['url']['file']->getUid() : '');
         } else {
index 53b6f61..4fe43a4 100644 (file)
@@ -8,21 +8,28 @@
         <div class="element-browser-body">
             <f:if condition="{selectedFolder}">
                 <h3><f:translate key="LLL:EXT:recordlist/Resources/Private/Language/locallang_browse_links.xlf:folders" /></h3>
-                <span class="{f:if(condition: '{selectedFolder.combinedIdentifier} == {currentIdentifier}', then: 'bg-success')}" title="{selectedFolder.identifier}">
-                    {selectedFolderIcon -> f:format.raw()} {selectedFolderTitle}
+                <span class="{f:if(condition: '{selectedFolder.combinedIdentifier} == {currentIdentifier}', then: 'bg-success')}">
+                    <f:if condition="{selectedFolderUrl}">
+                        <f:then>
+                            <a href="{selectedFolderUrl}" class="t3js-fileLink list-tree-group" title="{selectedFolder.identifier}">{selectedFolderIcon -> f:format.raw()} {selectedFolderTitle}</a>
+                        </f:then>
+                        <f:else>
+                            {selectedFolderIcon -> f:format.raw()} {selectedFolderTitle}
+                        </f:else>
+                    </f:if>
                 </span>
                 <f:if condition="{itemsInSelectedFolder}">
                     <ul class="list-tree">
                         <f:for each="{itemsInSelectedFolder}" as="folder">
                             <li{f:if(condition: '{folder.identifier} == {currentIdentifier}', then: ' class="active"')}>
                                 <span class="list-tree-group">
-                                        <a href="{folder.url}" class="t3js-fileLink list-tree-group" title="{folder.name}">
-                                            <span class="list-tree-icon">
-                                                <span title="{folder.name}">{folder.icon -> f:format.raw()}</span>
-                                            </span>
-                                            <span class="list-tree-title">{folder.title}</span>
-                                        </a>
-                                    </span>
+                                    <a href="{folder.url}" class="t3js-fileLink list-tree-group" title="{folder.name}">
+                                        <span class="list-tree-icon">
+                                            <span title="{folder.name}">{folder.icon -> f:format.raw()}</span>
+                                        </span>
+                                        <span class="list-tree-title">{folder.title}</span>
+                                    </a>
+                                </span>
                             </li>
                         </f:for>
                     </ul>