Problem/Motivation
drupal-check results on commit hash: d473fdbbac980b5435235f53dc2f1f5205e621af

 ------ ---------------------------------------------------
  Line   src/Form/MenuExportForm.php
 ------ ---------------------------------------------------
  66     Call to deprecated function drupal_set_message().
 ------ ---------------------------------------------------

 ------ ---------------------------------------------------
  Line   src/Form/MenuImportForm.php
 ------ ---------------------------------------------------
  92     Call to deprecated function drupal_set_message().
  94     Call to deprecated function drupal_set_message().
 ------ ---------------------------------------------------

 ------ --------------------------------------------------------------------------------
  Line   tests/src/Functional/MenuExportConfigurationFormTest.php
 ------ --------------------------------------------------------------------------------
         Class Drupal\Tests\menu_export\Functional\Form\MenuExportConfigurationFormTest
         was not found while trying to analyse it - autoloading is probably not
         configured properly.
 ------ --------------------------------------------------------------------------------


 [ERROR] Found 4 errors
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

arpitr created an issue. See original summary.

yogen.prasad’s picture

Assigned: Unassigned » yogen.prasad
yogen.prasad’s picture

Assigned: yogen.prasad » Unassigned
Status: Active » Needs review
FileSize
1.25 KB
yogen.prasad’s picture

jerdavis’s picture

Status: Needs review » Needs work
+++ b/src/Form/MenuExportForm.php
@@ -63,7 +63,7 @@ class MenuExportForm extends ConfigFormBase {
+    \Drupal::messenger()->addMessage('Menu Items exported successfully','status');

+++ b/src/Form/MenuImportForm.php
@@ -89,9 +89,9 @@ public function submitForm(array &$form, FormStateInterface $form_state)
+      \Drupal::messenger()->addMessage($this->t('Menu(s) @menus not found',['@menus'=>implode(',',$invalidMenus)]),'error');
...
+      \Drupal::messenger()->addMessage($this->t('Menu(s) imported successfully'),'success');

Because these forms extend ConfigFormBase, which extends FormBase, the MessengerTrait should already be added. This means that rather than calling the service, you should be able to use the MessengerTrait and call $this->messenger()->addMessage().

Akanksha92’s picture

Assigned: Unassigned » Akanksha92

Working on the suggestion.

Akanksha92’s picture

Status: Needs work » Needs review
FileSize
1.66 KB

Please review the updated patch using $this->messenger.

Akanksha92’s picture

Assigned: Akanksha92 » Unassigned
Musa.thomas’s picture

Status: Needs review » Closed (duplicate)