Problem/Motivation

1. install the menu_svg_icon
2. create a new menu
3. export the configuration
4. import the configuration in a new environment
5. change the order of links (optional)
6. save the menu

Expected result is a successfull message.

What happen is this error:

Drupal\Core\Config\ConfigDuplicateUUIDException: Attempt to save a configuration entity 'main-navigation-en' with UUID '' when this entity already exists with UUID 'db2b3f27-8f00-4fbc-ac31-870db710ac72' in Drupal\Core\Config\Entity\ConfigEntityBase->preSave() (line 339 of core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php).

Proposed resolution

On _menu_svg_icons_menu_edit_form_submit is always created a new configuration.
When a configuration entity already exists load it and save a new value, when not exists create it.

Remaining tasks

Write a patch

CommentFileSizeAuthor
#5 2924251.patch774 bytesziomizar
#5 interdiff.txt506 bytesziomizar
#2 2924251.patch770 bytesziomizar

Comments

ziomizar created an issue. See original summary.

ziomizar’s picture

Status: Active » Needs review
StatusFileSize
new770 bytes
s_leu’s picture

Status: Needs review » Needs work
+++ b/menu_svg_icons.module
@@ -47,7 +47,17 @@ function _menu_svg_icons_menu_edit_form_submit($form, FormStateInterface $form_s
+    $icon_menu_elm = new IconSetMenu([

Change looks good, nice catch.

We should use the static method EntityInterface
::create to create the new entity.

AndersNielsen’s picture

Hi s_leu,
Any chance you could make a patch with the entityInterface::create ? then I'd be happy to put this in the module

ziomizar’s picture

Status: Needs work » Needs review
StatusFileSize
new506 bytes
new774 bytes

This is the patch with the static method entityInterface::create

AndersNielsen’s picture

Status: Needs review » Fixed

Finally got some time. Thank you for the work, pushed to dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.