diff --git a/chatbot_lite.info.yml b/chatbot_lite.info.yml index 602db591f78c577f0f292a2908e7d52a3294e5d0..1f57fa2bbdfc11df1b6ae7209ac9cbb1f1869bbc 100644 --- a/chatbot_lite.info.yml +++ b/chatbot_lite.info.yml @@ -4,4 +4,4 @@ configure: chatbot_lite.settings package: Chatbot type: module version: '1.0.0' -core_version_requirement: ^8 || ^9 \ No newline at end of file +core_version_requirement: ^8 || ^9 || ^10 \ No newline at end of file diff --git a/src/Controller/ChatbotLiteAnswers.php b/src/Controller/ChatbotLiteAnswers.php index 9093f914d9e9c1c51e1aeb72b8103be4b9352131..b698e9ba979fce0a2923865edf8fdc530a57ca14 100644 --- a/src/Controller/ChatbotLiteAnswers.php +++ b/src/Controller/ChatbotLiteAnswers.php @@ -3,6 +3,7 @@ namespace Drupal\chatbot_lite\Controller; use Drupal\Core\Controller\ControllerBase; +use Drupal\Core\Url; /** * Chatbot Lite Answers class. @@ -103,7 +104,7 @@ class ChatbotLiteAnswers extends ControllerBase $this->answer = $answers[0] . '<BR/>'; foreach ($nodes as $node) { - $url = \Drupal\Core\Url::fromRoute('entity.node.canonical', ['node' => $node->id()]); + $url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()]); $this->answer .= '<a href="' . $url->toString() . '" class="ui-button">' . $node->label() . '</a>'; } } diff --git a/src/Form/ChatbotLiteForm.php b/src/Form/ChatbotLiteForm.php index eab50be0803bddb278113b57b092f8dc13986470..e146e5071c343f591a3cd93e50b7c8b1803cf529 100644 --- a/src/Form/ChatbotLiteForm.php +++ b/src/Form/ChatbotLiteForm.php @@ -2,6 +2,7 @@ namespace Drupal\chatbot_lite\Form; +use Drupal\user\Entity\User; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Ajax\AjaxResponse; @@ -127,7 +128,7 @@ class ChatbotLiteForm extends FormBase { $response = new AjaxResponse(); $domId = '#edit-chatbot-lite-body'; - $user = \Drupal::currentUser()->isAnonymous() ? $this->t("You") : \Drupal\user\Entity\User::load(\Drupal::currentUser()->id())->get('name')->value; + $user = \Drupal::currentUser()->isAnonymous() ? $this->t("You") : User::load(\Drupal::currentUser()->id())->get('name')->value; $question_txt = strlen($form_state->getValue('chatbot-lite-input')) > 0 ? $form_state->getValue('chatbot-lite-input') : '...'; $question = '<div class="bot-message bot-question">' . '<div class="bot-user">'