Bug #19042
closedTCEmain doesn't respect given value for sorting
0%
Description
if you create a new record with TCEmain and you give a value for sorting field, eg
$recData['sys_template']['NEW'] = array(
'pid' => $id,
'title' => "+ext",
'sorting' => time()
);
(as found in core)
the sorting field is not respected and overwritten by internal function.
attached patch fixes this.
(issue imported from #M8872)
Files
Updated by Steffen Kamper over 16 years ago
i will make a new patch, where you don't define the value of sort field, but giving "top" or "bottom" as predefined to influence the inserted position.
Updated by Steffen Kamper over 16 years ago
ok, attached is a new patch.
default is insert new record as "first" element.
New is the option to insert element as "last" element by defining:
'sorting' => 'last'
This is done for records having pid>0, for workspace records i didn't touch the behaviour.
Updated by Oliver Hader over 16 years ago
I changed your patch a bit and added a new property for $TCA[table]['ctrl']:
-> insertAsLast: boolean
Thus, it can be defined, that new records which are not inserted after an already existing record, are inserted as first or last element in the listing.
Updated by Steffen Kamper over 16 years ago
thx olly, patch works fine!
I tested it with this array :
$recData['sys_template'][$newID] = array(
'pid' => $id,
'title' => "+ext",
'_INSERTAS' => 'last'
);
and result is as expected.
Updated by Dmitry Dulepov over 16 years ago
Guys, wait. TCEmain does not work this way. It determines sorting according to special rules. Your patch may break it.
Updated by Dmitry Dulepov over 16 years ago
Steffen, just set pid to negative uid value of the "previous" record. This is official supported way.
Updated by Steffen Kamper over 16 years ago
Dmitry, i tested it with the negative pid and it works, i also found it in documentation.
Anyway i had troubles to follow the code (2nd part in sorting-function).
It's bad documented and hard to undertand (my opinion).
Updated by Dmitry Dulepov over 16 years ago
I agree :( TCEmain is a very tricky and badly documented thing. Things like negitive pids for sorting are frustrating (why cannot it be done in a "normal" way?). But they already exist, we have to use them as is...
Once I spent several days (!) stepping torough code and analyzing how it works. I think I will write a set of articles about TCEmain some time later.
Updated by Alexander Opitz over 11 years ago
- Status changed from New to Needs Feedback
- Target version deleted (
0)
The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?
Updated by Alexander Opitz about 11 years ago
- Status changed from Needs Feedback to Closed
- Is Regression set to No
No feedback for over 90 days.