I have User, Language, and Content translation enabled.
I created a couple of user accounts before Language and Content Translation were enabled (especially user 1, no choice in that matter!).
I have User entities set to translatable, and I've added a translatable text field to the user account entity.
If I go to the Translate tab for a user account, such as user/1/translations, I get a PHP error. I've seen this on other translation pages too:
Warning: array_filter() expects parameter 1 to be array, null given in content_translation_overview() (line 49 of core/modules/content_translation/content_translation.pages.inc).
content_translation_overview(Object)
Drupal\content_translation\Controller\ContentTranslationController->overview(Object)
call_user_func_array(Array, Array)
Drupal\Core\Controller\HtmlPageController->getContentResult(Object, '\Drupal\content_translation\Controller\ContentTranslationController::overview')
Drupal\Core\Controller\HtmlPageController->content(Object, '\Drupal\content_translation\Controller\ContentTranslationController::overview')
call_user_func_array(Array, Array)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)
If I go to the Edit tab and save the entity (forcing it to save the content language, which maybe wasn't on the user before?), then go back to Translate, the errors go away.
So I think this is because when I originally created the users, the language wasn't set up. User 2 (created before language was installed) also has this problem, but not User 3 (created after language was installed).
Maybe this is a symptom of #1966436: Default *content* entity languages are not set for entities created with the API; however, user 2 was created in the UI, so I am not sure this applies?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 2323935-4.patch | 1.89 KB | andypost |
Comments
Comment #1
andypostComment #2
jhodgdonWe should probably postpone this until #1966436: Default *content* entity languages are not set for entities created with the API is taken care of, because I think it will prevent this problem.
Comment #3
andypostCurrently I get that warning when visiting
user/1/translationsComment #4
andypostThis removes warning but adds some todos
Comment #5
jhedstromI think this makes sense (although ideally we'd just get the patch mentioned in the
@todocommitted).Comment #6
tstoecklerEspecially with this being refactored again in the future I think it makes sense to have some tests for this. Setting to needs work for that as skimming the issue summary it seems that wouldn't be rocket science. Please reset if I missed something.
Comment #9
Anonymous (not verified) commented#1916790: Convert translation metadata into regular entity fields got in, so the todo's probably can be removed/replaced now.
Comment #10
jhedstromIs there anything left to be done here then? In manual testing, this appears fixed by #1916790: Convert translation metadata into regular entity fields.
Comment #11
omar commentedTested process manually and cannot reproduce (any) errors with beta10. Closing ticket.
Comment #12
jhodgdonHm. OK, I checked again on my local machine just to be sure (it has strict PHP warnings being shown):
- Created a text field for Users.
- Created a user and edited user 1 to add values to that field.
- Enabled Language and Content Translation
- Added Spanish language
- Set up User entity, and that field on User, to be translatable
- Visit user/1/translations and user/2/translations
==> Here, there is one oddity, in that it says that the English version is "Not published" in the list of translations.
- Click Add from here to add a translation, which goes to es/user/1/translations/add/en/es - this seems OK
And then after translating, when I go back to the User list page, I have two copies of User 1. That's also not right, but it's a separate issue.
So the warning is gone but the problem is not exactly completely gone.
Comment #13
jhodgdonComment #22
quietone commented@jhodgdon, thanks for the error report and the clear steps for testing.
I tested this on 8.6.19, starting from a fresh install of the standard profile.
I used these steps, from #12. The '***' indicates where my results differ.
- Created a text field for Users.
- Created a user and edited user 1 to add values to that field.
- Enabled Language and Content Translation
- Added Spanish language
- Set up User entity, and that field on User, to be translatable
- Visit user/1/translations and user/2/translations
*** There is NO error here the English version is Published.
- Click Add from here to add a translation, which goes to es/user/1/translations/add/en/es - this seems OK
And then after translating, when I go back to the User list page, I have two copies of User 1. That's also not right, but it's a separate issue.
*** This is no longer true, there is just 1 copy of user 1 and 1 copy of user 2.
Based on this testing this issue has been fixed. Since this was reported when Drupal 8 was in beta it isn't surprising that this has been fixed somewhere along the way. I haven't searched for the issue that fixed this, just relying on manual testing.
closing as outdated.