Issue Bug Closed

#17404Sorting of remaining section elements in flexforms fails after deleting a section element

Jens Köster 06/20/07, 14:30 updated 09/05/11, 10:18

Description

How to reproduce it?

1. Create a FCE containig a section/array and fill it up with content, let’s say
Element 1
Element 2
Element 3
Element 4

2. Delete Element 2 (click the delete checkbox and click the save button).

3. Now try to sort the remaining elements to reverse order:
Element 4
Element 3
Element 1

There will be some strange behaviour during this process.

What’s going wrong?
Sorting ist done by using class.t3lib_tcemain.php -> _MOVE_FLEX_FORMdata().
If you move an element up/down, the element ist swapped with its adjacent element ($key+/-1).
Deleting ist done by using class.t3lib_tcemain.php -> _DELETE_FLEX_FORMdata().
It is done by simply using unset(). The adjacency ($key+/-1) is not maintained during this process, which causes the error.

The patch fixes this loss of adjacency simply by rearranging all indices before using unset().

(issue imported from #M5828)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.