Closed nattywebdev closed 10 months ago
Line 262 now corrected.
When showing a list of files and/or folders, clicking on any of the headings to sort doesn't work correctly. The display order changes, but it is hard to see what the order is - it's certainly not (say) alphabetical order of file or folder names. Same for Size and Date columns.
This is not a problem in the unpatched version, so the cause is my fix. I'd value any insight into the cause by @argiepiano ...
Patch submitted as https://github.com/backdrop-contrib/filebrowser/pull/4
@nattywebdev it looks like your patch changes the assignment of $a and $b, which are used for comparison:
This is true for $b as well. While I haven't tried this myself, see if this solves your problem:
$sorter = function ($a, $b) use ($field) {
$a = isset($a[$field]) ? $a[$field] : 0;
$b = isset($b[$field]) ? $b[$field] : 0;
return $a-$b;
};
and
$sorter = function ($a, $b) use ($field) {
$a = isset($a[$field]) ? $a[$field] : '';
$b = isset($b[$field]) ? $b[$field]: '';
return -strcmp(backdrop_strtolower($a), backdrop_strtolower($b));
};
I've made those changes and now the sorting works correctly. I've created another PR - or should it be an update to this one?
@nattywebdev it's better to keep pushing changes to the same PR rather than open a new PR.
At this point this is fine - you can go ahead and close this PR in favor of #6
Closing this in favor of #6
Remove create_function(); Replace inline style for file/folder icon with class 'icon'
This fixes issue 2 related to deprecated php function create_function for php later than 7.2. Taken from patches provided for Drupal version of the module and adapted for Backdrop - see: https://www.drupal.org/project/filebrowser/issues/3061756
Also addresses separate issue related to display of file/folder icons: containing table cell (td) had width set as % and this is replaced by a class added to the cell.