From 6395781cf6af719d60162ccdd43abf783682b3a8 Mon Sep 17 00:00:00 2001 From: Tero Elonen Date: Wed, 18 Oct 2023 17:13:38 +0300 Subject: [PATCH 1/3] UHF-8926: Add check to see if the content_translation_status value is set when submitting the node form --- helfi_navigation.module | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/helfi_navigation.module b/helfi_navigation.module index 5a5f714..79aa279 100644 --- a/helfi_navigation.module +++ b/helfi_navigation.module @@ -210,7 +210,10 @@ function helfi_navigation_form_node_form_submit(array $form, FormStateInterface if ($link->hasTranslation($langCode)) { $link = $link->getTranslation($langCode); } - $link->set('content_translation_status', $values['content_translation_status']) - ->save(); + + if (isset($values['content_translation_status'])) { + $link->set('content_translation_status', $values['content_translation_status']) + ->save(); + } } } From 7732f3d0bb1f1fca6a7e2d22286b5507b47036e2 Mon Sep 17 00:00:00 2001 From: Tero Elonen Date: Wed, 18 Oct 2023 17:15:02 +0300 Subject: [PATCH 2/3] UHF-8926: Add comment on the new line of code --- helfi_navigation.module | 1 + 1 file changed, 1 insertion(+) diff --git a/helfi_navigation.module b/helfi_navigation.module index 79aa279..a525579 100644 --- a/helfi_navigation.module +++ b/helfi_navigation.module @@ -211,6 +211,7 @@ function helfi_navigation_form_node_form_submit(array $form, FormStateInterface $link = $link->getTranslation($langCode); } + // User needs Administer menus and menu links -permission for this field to exist. if (isset($values['content_translation_status'])) { $link->set('content_translation_status', $values['content_translation_status']) ->save(); From 55c3eb7cfb32a1acc589e84609aa065732381404 Mon Sep 17 00:00:00 2001 From: Tero Elonen Date: Wed, 18 Oct 2023 17:18:44 +0300 Subject: [PATCH 3/3] UHF-8926: Fix PHPCS --- helfi_navigation.module | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helfi_navigation.module b/helfi_navigation.module index a525579..55d89a6 100644 --- a/helfi_navigation.module +++ b/helfi_navigation.module @@ -211,7 +211,8 @@ function helfi_navigation_form_node_form_submit(array $form, FormStateInterface $link = $link->getTranslation($langCode); } - // User needs Administer menus and menu links -permission for this field to exist. + // User needs Administer menus and menu links -permission for + // this field to exist. if (isset($values['content_translation_status'])) { $link->set('content_translation_status', $values['content_translation_status']) ->save();