Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Translation issues with modal admin #129

Closed
laryn opened this issue Mar 10, 2022 · 4 comments · Fixed by #130
Closed

Translation issues with modal admin #129

laryn opened this issue Mar 10, 2022 · 4 comments · Fixed by #130

Comments

@laryn
Copy link
Member

laryn commented Mar 10, 2022

I added locale/translation on a site and when a page has a language set, the modal admin won't save new paragraphs from the front end. Log shows:

Notice: Undefined index: en in ParagraphsItemEntity->save() (line 456 of /app/modules/paragraphs/ParagraphsItemEntity.inc).

Modal sorting is also affecting when languages are involved:

TypeError: Argument 1 passed to backdrop_sort() must be of the type array, null given, called in /app/modules/paragraphs/paragraphs.admin.inc on line 544 in backdrop_sort() (line 7272 of /home/managed/websites/jointheherd.net/production/web/core/includes/common.inc).

@argiepiano
Copy link
Contributor

argiepiano commented Mar 10, 2022

Looking at it very quickly....

That chunk of code is iterating through the hosting entity's field's delta to assign them a the paragraph entity, as in $node->field_name['en'][$delta]['entity'] = paragraph_entity

So I think the problem is with the host entity. It looks like the field in that host entity (the node) doesn't have a language code. Not sure why.

@laryn
Copy link
Member Author

laryn commented Mar 10, 2022

Thanks for checking, @argiepiano -- it does look like fields are not being saved with language codes (at least on a number of my sites, I haven't spun up a blank site to test yet). That does seem strange!

@laryn
Copy link
Member Author

laryn commented Mar 10, 2022

I linked a PR that solves it for now: https://github.com/backdrop-contrib/paragraphs/pull/130/files

Maybe it won't be needed if we track down why Backdrop fields seem to be always set to LANGUAGE_NONE.

@laryn
Copy link
Member Author

laryn commented Mar 10, 2022

Updating the top as it also seems to affect the modal sorting...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants