Fatal error in AiTranslateForm if no ai model is selected (php 8.3)

Created on 17 November 2024, 5 months ago

Problem/Motivation

When you installed the module, but no providers yet. The AiTranslateForm triggers an error + a warning:

Warning: Undefined array key 1 in Drupal\ai_translate\Form\AiTranslateForm->buildForm() (line 116 of /var/www/html/modules/contrib/ai/modules/ai_translate/src/Form/AiTranslateForm.php)

TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 238 in Drupal\Component\Utility\Html::escape() (line 431 of /var/www/html/core/lib/Drupal/Component/Utility/Html.php).
Severity	Error

Steps to reproduce

- Install the ai module and the ai translate module, but no providers.
- Go the the translate tab of a node.

Proposed resolution

Add type checks on the ai mode.

๐Ÿ› Bug report
Status

Active

Version

1.0

Component

Other Submodules

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium nils.destoop

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024