Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In Drupal 7.35, with Views 7.x-3.10, Internationalization 7.x-1.12, Internationalization Views 7.x-3.x-dev (2014-Oct-23 ) , Better Exposed Filters 7.x-3.0 - after update BEF to 7.x.-3.1 get Notice:
Notice: Array to string conversion in i18nviews_plugin_localization_i18nstrings->stringid() (line 66 of /var/www/ .......................sites/all/modules/i18nviews/includes/i18nviews_plugin_localization_i18nstrings.inc).
After installing of BEF 7.x-3.0, notice disappeared.
Could this be changed to accept arrays?
Comment | File | Size | Author |
---|---|---|---|
#11 | array_to_string_conversion_in_i18nviews_plugin_localization_i13nstrings-2464901-11.patch | 658 bytes | michel.settembrino |
Comments
Comment #1
NIKS_Artreaktor CreditAttribution: NIKS_Artreaktor commentedStart from version better_exposed_filters 7.x-3.1
Release notes
The main change in this release is that BEF now provides translations for all BEF setting strings. Yea for translations! However...
BEF has his own translation.
I so that in array $keys ( Array of keys for the string to be translated.) not integer key - are BEF added keys.
It is maybe not the best fix for this problem, but I filtering array with keys (line 66) to only integer key.
So, I changed function function stringid($keys) to
But, another way to fix it - implode second array, that inside. Then we seems to me will can to translate BEF strings.
Here is the code
Comment #2
mitkompm CreditAttribution: mitkompm commentedNIKS_Artreaktor, thank you.
Have tried second way, it works with BEF 7.x-3.2 edition. No errors.
Comment #3
Chris7419 CreditAttribution: Chris7419 commentedHi i have the same error like mitkompm! If i update BEF from 7.x-3.0 to 7.x.-3.1 or 7.x-3.2 i get the "Array to string conversion in i18nviews_plugin_localization_i18nstrings". BEF works only with 7.x-3.0 edition.
Comment #4
mitkompm CreditAttribution: mitkompm commentedChris7419, you should apply change of code ("patch") from #1 to i18nviews/plugins/i18nviews_plugin_localization_i18nstrings.inc.
Comment #5
mikeker CreditAttribution: mikeker commentedI think the root of the problem is that BEF removed it's support for I18N Strings-based translations in 3.1, using core's Locale module and Views' default localization plugin. The hope was to give a more consistent interface to translate all BEF settings rather than the single one that had been wired up to work with I18N Strings. Anyhow, I expected there would be some fallout from this change and I apologize for it.
I'm guessing that the string translations for BEF are still in the I18N datastore. Can you try deleting the translation for the BEF exposed sort settings and see if the PHP notice goes away? (You may want to save the translation before deleting it as you'll need to add it to
admin/config/regional/translate/translate
. See the handbook page for details.)Comment #6
jaydee1818 CreditAttribution: jaydee1818 commentedMy logs are getting smashed with this error message since upgrading to the latest version of BEF.
In this case I am using a filter based on a taxonomy term. I tried removing the translations of each term (which was tedious) plus the translation of the label within the i18N Views translation interface. The translation for "- Any -" seems to be automatic so I was unable to do anything about that. To cut a long story short, I couldn't fix it. Reverting back to previous version of BEF for now.
Perhaps there is a smooth process for upgrading?
Comment #7
PlayfulWolf CreditAttribution: PlayfulWolf commented@mikeker, my pages are spammed with those warnings - what exact steps should I (we) do? Site is multilingual, so there is many strings to delete
Comment #8
mikeker CreditAttribution: mikeker commented@jaydee1818, @PlayfulWolf, I'm sorry for the headaches the latest BEF update is causing.
I just tried moving between BEF 3.0 and 3.2 with a translated exposed sort string and, I agree, it's causing all sorts of warnings. There is only one BEF string in translation in 3.0 -- the exposed sort rewrite setting -- so I'm not sure why it's causing a warning for each string in translation when you upgrade beyond 3.0. At this point I haven't found a good way to clean up the notices through the UI. I'd recommend using the suggestion in #1.
Perhaps the root of the problem is being able to remove strings from the translation database when a module is uninstalled (or, in this case, upgraded to a version that no longer supports the i18n module). I'll try to look into this some more tomorrow...
Comment #9
bdupls CreditAttribution: bdupls commentedI had this error also. You have to take care not to have better_exposed_filters used in views if you change to basic filters then disable better exposed filters, error goes away.
Maybe a check in the module should exist to prevent disabling if used in views.
Comment #10
mikeker CreditAttribution: mikeker commented@bettledupls: See #1182064: Fatal error after disabling Better Exposed Filters. But there's a bit of a chicken-and-egg problem -- that check was added after the I18N code was removed, so it doesn't help is this situation.
Thanks for posting your workaround.
Comment #11
michel.settembrino CreditAttribution: michel.settembrino commentedI had the same issue. I have tried second way (from #1) and it works with Better Exposed Filters version 7.x-3.2
I created a patch file that does this changes. See array_to_string_conversion_in_i18nviews_plugin_localization_i13nstrings-2464901-11.patch
Comment #12
langweer CreditAttribution: langweer commentedThank you for the patch!
I ran into the same issue when updating BEF from 7.x-3.0 to 7.x-3.2. After I applied the patch, not more errors are logged.
Comment #13
matthiasm11 CreditAttribution: matthiasm11 at Randstad Digital commentedI can confirm the patch from #11 works.
Comment #14
NIKS_Artreaktor CreditAttribution: NIKS_Artreaktor commentedCan anybody say what solution from #1 better?
In FIRST solution BEF string will translate elsewhere.
In SECOND solution BEF string it seems to me will translate in Internationalization Views table of views translation.
Comment #15
Goekmen CreditAttribution: Goekmen commentedI can confirm the patch from #11 too.
Comment #16
Daemon_Byte CreditAttribution: Daemon_Byte as a volunteer commentedcan also confirm the patch
Comment #17
tormu CreditAttribution: tormu commented+1 for the patch #11
Comment #18
rcodina CreditAttribution: rcodina commented+1 for patch on #11
Comment #19
nizer CreditAttribution: nizer commented+1 for patch on #11
Comment #20
olak CreditAttribution: olak commented+1 for patch on #11
worked for views 3.11, BEF 3.2
Comment #22
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedThanks for the reviews!
Comment #23
dqdwebflo++
jonhattan++
MS-Informatique++