Closed white-lukas closed 1 week ago
Hi, thanks for reaching out. Let me first double check if I understand this correctly. Your structure looks something like that: -- racefietsen ------ starters racefiets -- heren ------ starters racefiets ---------- starters racefiets
And you're saying that if you pass [<heren/starters-racefiets/starters-racefiets>, <racefietsen/starters-racefiets>]
to the fillGapsInElements()
, you get back 4 of the above mentioned elements:
And if you flip the order and pass [<racefietsen/starters-racefiets>, <heren/starters-racefiets/starters-racefiets>]
, you get back all 5 of the above mentioned elements:
Is that correct?
complete structure is
When passing in [<heren/starters-racefiets/starters-racefiets>, <racefietsen/starters-racefiets>]
I miss the fietsen/racefietsen
category, as then this is getting added and filters out the lower lft
value of the racefietsen/starters-racefiets
entry
Thanks for confirming. I raised a PR for this.
Craft 4.13.3 and 5.5.1 are out with that fix. Thanks again!
What happened?
Description
When trying to get all structure elements from an array of elements, The
fillGapsInElements
is not returning all elements from the structure, it's depending on the sort order of the given elements.Example: when passing in 2 elements into the function with the following structure:
The
lft
value of the first element is117
, the second14
When passing the elements in this order the returned array is missing the
fietsen/racefietsen
entry.When I would change the order of the passed in elements the
fietsen/racefietsen
entry is returned as wellCraft CMS version
5.4.10.1
PHP version
8.3.13
Operating system and version
Ubuntu 24.04
Database type and version
mysql 8.0
Image driver and version
No response
Installed plugins and versions
-