From 495263e600b0133feab5b1aa798b89b0c93e06b0 Mon Sep 17 00:00:00 2001
From: Mingsong <2151-AMDS@users.noreply.drupalcode.org>
Date: Thu, 8 Sep 2022 15:33:36 +1000
Subject: [PATCH] Issue #3308511: Deprecated function: htmlspecialchars():
 Passing null to parameter #1

---
 src/Form/JsonapiResourceConfigForm.php | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/Form/JsonapiResourceConfigForm.php b/src/Form/JsonapiResourceConfigForm.php
index 15ed1c9..f85837a 100644
--- a/src/Form/JsonapiResourceConfigForm.php
+++ b/src/Form/JsonapiResourceConfigForm.php
@@ -203,18 +203,17 @@ class JsonapiResourceConfigForm extends EntityForm {
   public function save(array $form, FormStateInterface $form_state) {
     $resource_config = $this->entity;
     $status = $resource_config->save();
+    $type = $resource_config->get('resourceType') ?? '';
 
     switch ($status) {
-      case SAVED_NEW:
-        $this->messenger()->addStatus($this->t('Created the %label JSON:API Resource overwrites.', [
-          '%label' => $resource_config->id(),
-        ]));
+      case SAVED_NEW :
+        $this->messenger()->addStatus($this->t('Created the %type JSON:API Resource overwrites.', [
+          '%type' => $type]));
         break;
 
-      default:
-        $this->messenger()->addStatus($this->t('Saved the %label JSON:API Resource overwrites.', [
-          '%label' => $resource_config->id(),
-        ]));
+      default :
+        $this->messenger()->addStatus($this->t('Saved the %type JSON:API Resource overwrites.', [
+          '%type' => $type]));
     }
     $form_state->setRedirectUrl($resource_config->toUrl('collection'));
   }
-- 
GitLab