Open eleven3 opened 8 months ago
While I'm no expert on this module, this seems to be a problem with your configuration file i18n.settings.json
. When i18n_string
is enabled, it should write some information about allowed text formats to that file, automatically selecting the filter_fallback_format()
format as translatable. Apparently this is missing in your installation.
As a quick fix, visit admin/config/regional/i18n/strings
(you'll see a warning) and then click "Save". This should populate the missing configurations and should remove the warnings.
As to why this happened... I'm not sure. Maybe something went wrong during the installation of the string translation module.
The maintainer of this module may have more accurate insights.
@eleven3 many thanks for your report, and @argiepiano many thanks for your quick and correct answer.
The first thing that comes to my mind: is the site (with this error) upgraded from Drupal 7 or is it a native Backdrop install.
Because it's not really clear to me, how $translatable_formats can end up unset. It gets set when enabling the module and when upgrading from D7.
In case, you didn't save the form yet (which is the correct fix), can you provide a screenshot from the form on /admin/config/regional/i18n/strings?
This was a in a native Backdrop site, not an update from D7. I was able to solve the problem by enabling translation on one of the text formats at admin/config/regional/i18n/strings, as suggested by @layrn in the backdrop forum.
Before that none of the text formats had had translation enabled and, as a result, none of them could be edited. But once one of them was enabled, then they all could be edited.
Thanks for filing this issue @eleven3!
@indigoxela Maybe adding a default in the config would solve this? https://github.com/backdrop-contrib/i18n/blob/1.x-1.x/config/i18n.settings.json
EDIT: Nevermind, just saw this in the install, but unsure why it didn't work in this case:
$config->set('i18n_string.allowed_formats', array(filter_fallback_format()));
Nevermind, just saw this in the install
@laryn right, that was the thing, that baffled me. How can that be NULL then... :thinking:
Will do some more experiments.
@eleven3 glad, that you were able to solve it.
Some experiments, but still can't reproduce the problem.
On a fresh install, the i18n_string.allowed_formats config item is always present.
I was wondering if the fallback maybe changed after i18n_string was installed, but I just verified that you can't even disable (let alone delete) the fallback format...
@laryn it's not the format (or missing format) that caused the notices, it's the result of config_get('i18n.settings', 'i18n_string.allowed_formats');
that was apparently NULL.
It can be empty, but it can't be null - it's always an array.
I am using the standard Filtered HTML text format in a Backdrop site (v 1.26.2, php 8.2x). This is on a development site running on my localhost, although the problem also exists with ckeditor4 on the live version of the same site.
When I click the Configure link in the dropdown next to Filtered HTML on /admin/config/content/formats, I consistently get an error message in watchdog:
TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 220 of {…}/modules/contrib/i18n/i18n_string/i18n_string.module).
The toolbars do appear and function correctly on the text fields where it is configured. However, it remains impossible to make changes to the configuration.