[BUGFIX] ElementBrowser does not highlight selected file in file list view 02/50502/7
authorJörg Bösche <typo3@joergboesche.de>
Fri, 4 Nov 2016 14:34:47 +0000 (15:34 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Mon, 7 Nov 2016 12:14:33 +0000 (13:14 +0100)
FileLinkHandler in element browser should highlight the selected file
reference in browser. If the link value is "file:12345" the part after
"file:" from the string will be extracted and has to be cast as an int.
The later check for CSS class "active" in file list compares two numbers,
so the ID must be of type integer.

Resolves: #78574
Releases: 7.6
Change-Id: I11f8bf6bc73a08ff72edcb4769a206010d0226af
Reviewed-on: https://review.typo3.org/50502
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/recordlist/Classes/LinkHandler/FileLinkHandler.php

index b74baa9..b2ad522 100644 (file)
@@ -87,6 +87,7 @@ class FileLinkHandler extends AbstractLinkHandler implements LinkHandlerInterfac
                     $this->linkParts = $linkParts;
                     $this->linkParts['url'] = $rel;
                     $this->linkParts['name'] = $fileOrFolderObject->getName();
+
                     return true;
                 }
             } catch (FileDoesNotExistException $e) {
@@ -231,7 +232,7 @@ class FileLinkHandler extends AbstractLinkHandler implements LinkHandlerInterfac
             $out .= '<ul class="list-tree">';
             foreach ($folderContent as $fileOrFolderObject) {
                 list($fileIdentifier, $icon) = $this->renderItem($fileOrFolderObject);
-                $selected = $currentIdentifier === $fileIdentifier ? ' class="active"' : '';
+                $selected = (int)$currentIdentifier === $fileIdentifier ? ' class="active"' : '';
                 $out .=
                     '<li' . $selected . '>
                         <span class="list-tree-group">