netzmacht/contao-leaflet-maps

Invalid alias on duplicate

Closed this issue · 4 comments

When duplicating items (regardless their type) in the Map Layer section, the system creates an invalid alias which prevents the map to be displayed. Only on opening/saving the item, a warning is displayed:
2019-02-06 12_16_14-karten-layer layer id 59 bearbeiten - contao open source cms

How do you duplocate the layers? Do you use edit multilple? If I duplicate with the operation button the alias is empty. The suffix seems to be added by Contao automatically.

OK, I checked: when duplicating one by one, the copy gets a correct alias. The error indeed occurs when using the "multiple edit" feature (which I intended to use in order to keep the structure). Maybe it would be a good idea to disable the "multiple edit" feature as it does not really work for them moment (at least not as intended as it does not recreate structures)?

Thanks for confirming my suspicion. That's just one of the odd behavious of the DC_Table.

https://github.com/contao/contao/blob/e79f4cb153e09f34c678e500b9031990b8bd81c5/core-bundle/src/Resources/contao/drivers/DC_Table.php#L904-L907

Gonna have to add an oncopy_callback to fix the aliases.

The solution is to not copy the alias. An empty alias would be created. Then creating the Javascript an auto alias is used instead.