After a recent update of Field Collection, Entity Translation, and i18n, I started seeing the following warning message:
"The entities of type Field collection item do not define a valid base path: it will not be possible to translate them."
My module versions are as follows:
Field Collection: 7.x-1.0-beta4+4-dev
Entity Translation: 7.x-1.x-dev (6-16-12)
i18n: 7.x-1.7
I'm not sure if this is a Field Collection issue or an Entity Translation issue, but given what I've read in other issue queues, I thought I'd start here. (Honestly, I'm not even sure if it's a problem because the fields comprising the field collection should still be translatable, but the warning message is an annoyance.)
Anyway, please let me know what your thoughts are on this.
Thanks,
C.
Comments
Comment #1
msavike CreditAttribution: msavike commentedHave the same problem here! if the warning messages critical or not, looking forward to a reply.
Comment #2
cossimo CreditAttribution: cossimo commentedBumping... a reply really would be appreciated.
C.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedHave the same problem with english & french website using field_collection and i8n
Look here : http://drupal.org/node/1513406
Solution seems to be in the Entity API : "I can confirm that updating to the April 2 dev release of Entity API resolves this error message."
I've downloaded the last version (rc3 on August 2012) and all is OK now.
Cooool :)
Comment #4
cossimo CreditAttribution: cossimo commentedRe: #3 -- I don't think this is the same issue. I was running Entity API 7.x-1.0-rc3 when I started having this problem. Plus, the error message is different.
Comment #5
cossimo CreditAttribution: cossimo commentedI'm finding that field collection is throwing the following errors when trying to edit or translate nodes with Field Collection fields that are set to translatable.
When editing, the following message appears:
And when translating, the following messages appear:
The errors render the node untranslatable, and translation has to be turned off for the field collection field in order to translate the node.
While I lack the skill set to contribute to resolving this issue, I'd be willing to subsidize anyone willing to fix this problem.
Thanks,
C.
Comment #6
phreaknerd CreditAttribution: phreaknerd commentedPlease have a look at this patch. Seems to fix the error from @cossimo.
The notice "The entities of type Field collection item do not define a valid base path: it will not be possible to translate them." appears because of a missing entity_translation_handler for field_collections. (Insight: field-collections are handled like nodes and so doesn't need an own handler but entity_translation throws this message anyway.)
Comment #7
cossimo CreditAttribution: cossimo commentedThanks phreaknerd... I tested out the #6 patch, and it seems to move things closer, in that the errors in #5 no longer appear.
However, the message "Field Collection entities are untranslatable because they do not define valid base path" still occasionally appears and,
more importantly, when translating field collections, the translated entities appear for all languages, regardless of the user's current language, effectively acting as if they were language neutral. (For example, if you have an English translation and a french translation of a field collection, both translations appear in English, French, and any other language active on the site.)Comment #8
cossimo CreditAttribution: cossimo commentedOkay, I take that back. #6 works as advertised. I forgot that I was using Views to render the field collections (and the duplication across languages issue is a problem with Views -- http://drupal.org/node/1330332).
Comment #9
frikovc CreditAttribution: frikovc commentedI have same or similar issue as cossimo had - problems with field collection and translation of fields via entity translation. Tried everything I know - spend 2 days trying =(. Seemed the right place to post issue.
My configuration:
latest dev entity translation and field collection module + patch
I tried:
1. Entity translation is on just for taxonomy term and node, but not for field collection (it triggers notice: not translatible because of valid base path...)
I have taxonomy term with field collection (unlimited value). In FC field there are just two fields that needs to be translated. FC and fields inside FC have set "enable field translation by users".
With these settings I can create a term, set values to FC fields on default language and save. Then I can translate and set values to FC fields for second language and save. All good when checking if it did saved 2 different values - each for own language. Then I create view which is used on panels and is using termID as context filter. View has relationship on FC field and I added FC fields to show.
What happens: on view when i preview with term ID (context filter) i get correct result for the language in url (en/admin/structure/views..). Also when I change url to another languge prefix i get translated fields in that language. But translated fields don't show on actual term pages.
2. Beside what I described in 1., I also enable entity translation for field collection. Notice about valid base path is still there, but I applied patch and i don't get errors when adding or translating FC.
With this configuration I create fresh FC with new fields and enable field translation for all of them. On term I set some values for FC fields and save it. I repeat this step when translating. But when I save translations and open them they are empty. On the next fill they remain. But the view for this configuration is still not showing right values for selected languages.
Does anyone have any hint what I am doing wrong? I really need to fix this issue on my site and I am short on time.
What I need is to translate FC field (and it's fields) which can have unlimited values.
Any hints?
Comment #10
cossimo CreditAttribution: cossimo commentedfrikovc: I have been having similar issues to what you describe in scenario 2. Next week, I will do some more testing and post more about my experiences as well.
Comment #11
frikovc CreditAttribution: frikovc commentedBecause I am on a deadline I retested on clean installation. All this apply for what I described in #9. Same result but some new/confirmed observations and possible workaround:
There is a bug in FC when translating fields for the first time values are not properly saved:
After creating some content on terms and translating them with workaround, I tried to show them in panels via view.
After solving last problem, view for panel is working and viewing term in both languages shows correct (translated) FC fields =).
@cossimo: can you test this workaround on your end?
Hope it helps understanding where problems occur and how to go around them. Fix would be nice though =).
Comment #12
phreaknerd CreditAttribution: phreaknerd commented@frikovc: Can you check if this patch works for you? I've added the langcode to different functions so that the correct hostentity get's saved.
Comment #14
frikovc CreditAttribution: frikovc commented#12: field_collection_untranslatable-1683784-12.patch queued for re-testing.
Comment #16
frikovc CreditAttribution: frikovc commented@phreaknerd: patch failed because of the php syntax error (the line with == LANGUAGE_NONE), I used the original line and tried it on my test site.
Problem is that when I create term and add 2 or 3 FC fields, fields in orignal language are saved. When I try to translate them, they are proprely prepopulated with content from original language and can be saved. Problem occur when I want to edit translation - all FC fields are empty, can not be removed or added, but they are showing in the views. On edit original language, content is there and also I can add or remove FC fields without a problem.
Comment #17
phreaknerd CreditAttribution: phreaknerd commentedYeah, sorry. Will upload a new patch tomorrow. Meanwhile you can check the following:
* remove the option "translatable" from the field-items in the field-collection and mark only the field-collection itself as translatable.
Comment #18
frikovc CreditAttribution: frikovc commentedYup that did the trick. This partially fix the problem described in #16 (empty fields), but the still can not add or remove FC fields on translated page. It throws:
EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7562 of .../includes/common.inc).
edit: I can delete translation and then translate again - during translation I can add or remove unlimited number of FC fields. After I save translation, content of saved fields can be altered, but fields themself can't be added or deleted.
But we are getting closer =).
Comment #19
frikovc CreditAttribution: frikovc commentedSorry this was my mistake. Shouldn't use taxonomy localize with entity translation =).
Found new bug when I was testing term reference. Replicates on patched (#12) and not patched site. This probably isn't field collection fault.I have created new taxonomy - localized terms,created terms and orderd them hierarchically (didn't translate them yet)created CT with field translation and add term reference field.On creation of node of type CT, under term reference I can select all terms (this is test).Then I translate most of terms via field translationIf I try to create node of type CT when using original language prefix in URL (one that term were created), under term reference I can select only non translated terms and terms that were translated but last saved in default languageIf I try to create node of type CT when using translated language prefix in URL, under term reference I can select only terms that were last saved in translated language and terms that weren't translatedAlso one funny thing happens, randomly (still didn't found pattern) after term edit and save, term jumps out of its original hierachical place (eg. from depth 2 to root).
Comment #20
phreaknerd CreditAttribution: phreaknerd commentedThe corrected patch.
One thing: The fc-edit-form that is shown when using the "Add"-link in view mode don't work properly. I have to add the language here too. The field-content is saved as 'und' actually.
Comment #21
frikovc CreditAttribution: frikovc commentedThanks. Patch #20 works.
I add new fields via edit term form - FC field display is set to fields only. But probably that is same function.
Comment #22
remaye CreditAttribution: remaye commentedI tried to apply patch in #20 and it didn't fix the warning message :
But also I have maybe a slightly different behaviour :
- the message doesn't appear when editing or viewing Field Collection contents, but rather when validating modules admin page, or running update page or flushing cash (whatever page is displayed when flushing cash) and other admin pages
- the translated FC contents appears empty when I translate them for the first time, but after giving some values, translated fields keep their own values safe and display them properly.
- the "add" link is not working at all but displays no error message, just new FC item is not added neither in view and edit page.
I didn't try yet to recreate some new FC since I applied the patch (I'm running the same FC created before the patch), could it be the reason why it is not working.
Or is it a different issue ?
Comment #23
frikovc CreditAttribution: frikovc commentedNotice is still there but FC fields are translatable and saved so that could be edited again.
I also had empty fields... trick is that you have to set FC field to be translatable, translation for fields in FC have to be disabled.
Comment #24
cossimo CreditAttribution: cossimo commentedThe patch in #20 seems to work well. However, (and this may be a Views issue), the translated field collections do not appear to be filterable by language when rendered in Views -- i.e., all translations show up for all languages. This has been an ongoing problem for rendering translated entities in Views and was remedied with a recent patch (See http://drupal.org/node/1515156#comment-6301672), which exposes the language for translatable fields as potential Views filters.
However, the patched version of Views will not filter translated field collections by language (using the field collection field's language as the filter criteria), when using the field collection patch in #20 above and instructions outlined in this thread. It does seem that the patched version of Views can filter on the individual field items comprising the field collection when they are set to translatable. However, this conflicts with the instructions of #17 above... i.e.,
...and wreaks havoc on the ability to translate the field collections themselves.
Is there a way to expose the language of the field collection field itself so that Views can filter on it? Or is the field collection's language already exposed in a way that Views *should* be able to filter on?
Thanks,
C.
Comment #25
frikovc CreditAttribution: frikovc commented@cossimo: you have to make relationship on FC to get access to fields in it
My configuration:
FC field is set to be translatable, fields in FC are not set to be translatable
I have a view that has relationship to FC field. Then I add fields from FC based on that relationship. Under filters I have added FC field language = user's current language.
If you want to append it to panel you also need to add term or node ID and set it without validation. Set argument from context:Term/Node ID
Comment #26
cossimo CreditAttribution: cossimo commentedRe: #24 and #25:
After a little soul-searching and head-scratching, I figured out what I did wrong (and hopefully it will be helpful for anyone else creating views with translatable field collection fields). When I first created my views, I chose "Show Field Collection Item" instead of "Show Content" as the basis for the view. The field language filter will apparently not work if you do this.
So, for all you kids watching at home, don't do drugs... and always choose "Show Content" when creating a field collection view.
C.
PS... Props to phreaknerd... You are a lifesaver....
Comment #27
jackplain CreditAttribution: jackplain commented#20: field_collection_untranslatable-1683784-20.patch queued for re-testing.
Comment #28
carn1x CreditAttribution: carn1x commentedPatch in #20 won't apply to latest dev. I'm new to patches though, so I could be a moron, however I'm running:
field_collection.module.rej:
Comment #29
bartdepotter CreditAttribution: bartdepotter commentedPatch#20 works on field_collection 7.x-1.0-beta4.
A problem I ran into was that my new translated content was not entered the first time it was saved.
The fields went blank after saving the translation for the first time. When entering new content in the empty fields everything seems to work fine.
After some testing I figured out that removing the content first, through the 'Remove' button, the fields are also saved.
It's not an ideal solution but I can now translate content with field collections.
Comment #30
bartdepotter CreditAttribution: bartdepotter commentedPost #25 solved my problem.
Now my translation is saved without first removing the original content.
So only enable translation on the FieldCollection field and not on the fields inside the FieldCollection.
Thanks @frikovc.
Comment #31
kscheirerWhat's the status of this issue? Is the patch in #20 RTBC?
Comment #33
stijndm CreditAttribution: stijndm commentedAttached is an updated version of the patch for beta5
Comment #34
kscheirersetting to needs review to get testbot on it...
Comment #36
Hydra CreditAttribution: Hydra commentedShouldn't be the patch applyng agains dev instead of beta??
Comment #37
Hydra CreditAttribution: Hydra commentedchange status
Comment #38
Martin Mayer CreditAttribution: Martin Mayer commentedI applied the patch from #36. I still get this warnings:
Invalid translate path defined for entities of type Field collection item: parent menu item not found for field_collection_item/%field_collection_item
The entities of type Field collection item do not define a valid path scheme: it will not be possible to translate them.
Comment #39
BerdirThis is not necessary.
$langcode can not be left out as there are required values afterwards.
Comment #40
chriscalip CreditAttribution: chriscalip commented#39 What are you trying to say? The function definition does not need updating to include $langcode having a default value of LANGUAGE_NONE ? is that your trying to say?
Comment #41
BerdirExactly.
Comment #42
chriscalip CreditAttribution: chriscalip commentedok.
Comment #43
mattez CreditAttribution: mattez commented#42 YEAH works! THANX a lot. This PATCH saves my day.
Comment #44
remaye CreditAttribution: remaye commentedNot working at all for me.
is still here and behaviour describe in #22 remain the same.
When I create a new field_collection item using the "add item" link it add a field_collection with "und" language and indeed the new field doesn't appear in "fr" nor "en" language. If I change the "language" field in the database to "fr", it does appear in the "fr" page. And there is no way to set the language in the field_collection item edit form.
I don't know how this is related to the warning message (if it is) but there something not working well with field_collection language affectation...
Comment #45
eristoddle CreditAttribution: eristoddle commentedHere is what is working for me currently (crossing fingers). I didn't create a patch file because I am unsure if this was the correct way to do things or not. But I found that every time I created a field collection, the collection itself would be in the right language, but the fields were always und. Unless I created a translation and came back and edited the original. Right about line 897 in the field_collection_field_presave function of field_collection.module, I added this:
Which doesn't quite work. If I add a translation after the initial add, I have to save it twice to stick.
Comment #46
kscheirerGood docs on creating a patch: https://drupal.org/node/707484
Comment #47
malberts CreditAttribution: malberts commentedI've posted a patch at #1344672-17: Field Collection: Field translation (entity_translation) support. that attempts to bring in proper support for Entity Translations. Please have a look there.
Comment #48
eristoddle CreditAttribution: eristoddle commentedYeah, mine was a hack. Which is why I didn't create a patch. That patch semi-works. And seeing it, I realized how involved this whole fix is.
For example, I can create the field collection in English and it comes back up in the form when I edit it. That's a new one. Was used to seeing blank fields.
But when I go create a Spanish translation, the field collection is stored as spanish, but each of the fields that are in it are English. I checked the database. For some reason these do come up in the form under the Spanish tab, but are not displayed under Spanish in the frontend which makes sense.
So at the end of creating a record using this patch, I have:
entity
field-collection - en
field en
field en
field-collection - es
field en
field en
Comment #49
klonos...so should we close this one as a duplicate of the other issue then?
Comment #50
malberts CreditAttribution: malberts commentedI think so. This issue describes a sub-issue of integrating Entity Translation.
Marking as a duplicate of #1344672: Field Collection: Field translation (entity_translation) support.
Comment #51
RaulMuroc CreditAttribution: RaulMuroc commentedAnd patch in #42 should not be included in the other issue?
Comment #52
Naim BELKAIED CreditAttribution: Naim BELKAIED commentedYou can resolve this by disabling translation of field inside the field collection, the translation must be only related to field collection .
Comment #53
codevoice CreditAttribution: codevoice commented> You can resolve this by disabling translation of field inside the field collection, the translation must be only related to field collection .
Definitely not in my case, none of the field collections themselves have translation enabled, but I still suffer from these warnings.