I got the error:
TypeError: Return value of Drupal\Component\Utility\Html::decodeEntities() must be of the type string, null returned in /var/www/html/web/core/lib/Drupal/Component/Utility/Html.php on line 390 #0 /var/www/html/web/modules/contrib/tmgmt_deepl/src/Plugin/tmgmt/Translator/DeeplTranslator.php(301)
We should add a condition before decoding, because the string is not always transmitted, in my case it is an array.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | Screenshot 2023-03-06 at 21.12.31.png | 992.73 KB | dima.iluschenko |
| #6 | Screenshot 2023-03-06 at 21.24.41.png | 230.68 KB | dima.iluschenko |
| #2 | decodeEntities_error-3342781-2.patch | 819 bytes | dima.iluschenko |
Issue fork tmgmt_deepl-3342781
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3342781-htmldecodeentities-must-be
changes, plain diff MR !12
Comments
Comment #2
dima.iluschenkoAttached the patch for skipping all except a string.
Comment #3
steffenrThanks for the finding. You are the first one having problems with the notation in the module. Could you be a little more specific, what kind of data you try to translate or when the error happens (maybe you could add a debug breakpoint before).
Do you also have this problem with the tmgmt_google module - this uses the same logic as tmgmt_deepl.
I'll check your patch and bring it in the next release of the module (looks fine so far)..
Comment #6
dima.iluschenkoHi dear @SteffenR. I identified a problem. It relates to the combined field. In my case it was Mask Icon field from the Meta Tags module:


I believe we have to fix it in tmgmt module. I'll create an issue and attach the patch soon.
Comment #7
steffenrHi Dima,
Thanks for clarification. In this case it would make more sense, to declare this field as being non-translatable.
Just use the hook_tmgmt_translatable_fields_alter to remove those fields from your translatable fields like shown in the example:
You can use unset here or just set #translatable to false.
Comment #8
dima.iluschenkoHi Steffen,
It's good that we can exclude fields from the translations. However, we shouldn't get php error and see a broken process during translation for contrib modules.
Comment #10
dima.iluschenko@SteffenR Also we can't exclude only mask_icon in hook_tmgmt_translatable_fields_alter. We can exclude the entire meta tag field, so that won't help with my problem.
Comment #11
steffenr@dima.iluschenko:
You are right. The patch was already applied to the latest version of the module.
https://git.drupalcode.org/project/tmgmt_deepl/-/tree/2.1.9
Thanks for the finding.
Comment #13
steffenrComment #14
steffenr