Deprecation: #107225 - Boolean sort direction in FileList->start()
See forge#107225
Description
The fourth parameter of the method
\TYPO3\
has been renamed from $sort
to $sort
and now accepts both boolean
values (for backward compatibility) and
\Sort
enum values.
Passing a boolean value for the sort direction (fourth parameter of the method
\TYPO3\
) has been deprecated in favor of
the new
\TYPO3\
enum to provide better
type safety and clarity. The parameter name has also been changed from
$sort
to
$sort
to better reflect its purpose.
Impact
Calling
File
with a boolean value as the fourth parameter
will trigger a deprecation warning. The functionality will continue to work
but will be removed in TYPO3 v15.
Affected installations
All installations using
File
directly with a boolean
value for the sort direction parameter. This mainly affects custom file
browser implementations or extensions that directly instantiate and configure
the FileList class, even if it is actually marked as @internal
.
Migration
Replace boolean values with the corresponding
Sort
enum values:
use TYPO3\CMS\Filelist\Type\SortDirection;
// Before (deprecated)
$fileList->start($folder, $currentPage, $sortField, false, $mode);
$fileList->start($folder, $currentPage, $sortField, true, $mode);
// After
$fileList->start($folder, $currentPage, $sortField, SortDirection::ASCENDING, $mode);
$fileList->start($folder, $currentPage, $sortField, SortDirection::DESCENDING, $mode);
The migration maintains the same functionality:
true
(descending) →Sort
Direction:: DESCENDING false
(ascending) →Sort
Direction:: ASCENDING