Bug #19042
closed
TCEmain doesn't respect given value for sorting
Added by Steffen Kamper over 16 years ago.
Updated about 11 years ago.
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
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.
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.
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.
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.
Guys, wait. TCEmain does not work this way. It determines sorting according to special rules. Your patch may break it.
Steffen, just set pid to negative uid value of the "previous" record. This is official supported way.
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).
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.
- 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)?
- Status changed from Needs Feedback to Closed
- Is Regression set to No
No feedback for over 90 days.
Also available in: Atom
PDF