Fatal error: Class name must be a valid object or a string in (...)/sites/all/modules/entity_translation/entity_translation.module on line 495
This happens when I try to translate some content baseUrl/fr/node/3/translate
I'm investigating the cause of this issue. My first lead is that I use auto_nodetitle but I don't know yet what's causing this.
I could also be my synchronise translation settings, I don't know yet. If someone has the same error, please describe what you did. This is not coming by itself out of the box.
the actual line 495:
$handler = new $class($entity_type, $entity_info, $entity, $entity_id);
Comments
Comment #1
Jerome F commentedThere's a bunch of other errors coming along with this one on every page in a non default language, (once you switch to english it's gone, you can then go back to your foreign language with no error displayed, but when you check for updates in admin/reports/updates for example or after cache flush, it's displayed again):
Comment #2
Jerome F commentedWhat's the status of this module is there overlapping between internationalisation's content translation that can cause that kind of errors?
Comment #3
plachThere should not be, if there is we must fix it. The intended behavior is that the translation overview page for any entity is provided only if the
/translatepath is not already "taken" by i18n.Comment #4
Jerome F commentedThank you for your answer @plach.
I tried to uninstall entity translation - internationalisation content translation works. So there is an issue causing the fatal error with entity translation. I still have to test if that's not because I use auto_nodetitle and/or because I miss title module is missing (but if that's the cause, title should be mandatory imo).
Comment #5
plachCan you describe your setup and how to reproduce the issue? Is enabling ET + i18n enough or do you performed some particular configuration?
Comment #6
Jerome F commentedAs soon as I can reproduce this on a simple test site I let you know, thank you.
Comment #7
Jerome F commentedI can say that the lead about automatic node title is the wrong one. In a test environment, there's no problem with it. So I will look at Node location module which might be untranslatable by entity translation. EDIT: location is not the problem.
It's Multilingual content module OR translation overview module which needs to be disabled in my installation, but I still can't reproduce this in my test site.
Comment #8
Jerome F commentedHere it is !
To reproduce these errors, enable :
generate content and try to translate it
Comment #9
plachModule versions? ;)
Comment #10
Jerome F commentedDrupal core 7.2
Entity translation 7.x-1.x-dev (2011-May-25)
Internationalization 7.x-1.0-beta6
Translation Overview 7.x-2.0-beta1
Variable 7.x-1.0
Comment #11
omercioglu commentedI can confirm that enabling Translation Overview 7.x-2.0-beta1 is causing this problem, in my case.
Comment #12
webmestre commentedDisabling this module does the translation possible again.
Nothing better when installing the 7.x-2.x-dev version !
Comment #13
mvcI have this problem too. On the next page load I get the following error messages which I believe are related:
Comment #14
djac commentedReproduced with:
Drupal core 7.8
Entity translation 7.x-1.0-alpha1
Internationalization 7.x-1.0
Multilingual content (must be enabled to reproduce this error)
Translation Overview 7.x-2.0-beta1
Variable 7.x-1.1
The error is a result of conflicts between i18n_node, entity_translation and translation_overview. All 3 modules are implementing hook_form_alter and modifying the entry for 'node/%node/translate'.
I believe this issue should be fixed by #1172530: No way to assign existing nodes as translations with i18n_node, thus closing this issue as a duplicate.
Comment #15
djac commentedWe may be able to fix this in entity_translation. Re-opening for further investigation.
Comment #16
djac commentedHere's a first attempt at a patch which calls the appropriate callback after hook_menu and hook_menu_alter hooks run.
We may want to improve the filename handling. I'm not sure if the extension will always be .inc. Perhaps someone can comment.
Comment #17
plachThanks!
I think these lines can be replaced with something like the following:
See the related docs.
Comment #18
djac commentedThanks plach.
I've attached a second attempt.
Comment #19
plachI know this is how
module_load_include(), does but I'd say this code triggers two I/O operations instead of one. What about the following?After all avoiding to issue an error here is pretty useless since the execution is likely to terminate immediately after due to a fatal, since the page callback cannot be found.
Comment #20
djac commentedSounds good! I've attached another patch.
Comment #21
plach@djac:
Sorry for the delayed feedback, but this revealed trickier than what I originally thought to address: I tested your patch with core content translation and it appeared not to work. The main reason is that by implementing
hook_menu()we are not able to backup an existingnode/%node/translaterouter path, since there is no way to tell if it's there, and we simply override it with the ET router path. To address this problem I moved everything tohook_menu_alter(). Moreover access callbacks were not proxied.I tested the attached patch with core content translation and it seems to behave well. Would you please test it with
i18n_nodeandtranslation_overviewand report?Comment #22
renat commentedHello!
After applying the path against -dev version of Entity Translation, I received this error message:
Obviously there should be public_html/SITES/ALL/MODULES/entity_translation.admin.inc, not public_html//entity_translation.admin.inc
Comment #23
plach@djac:
Aside from #22, do you have anything else to report?
Comment #25
stevieb commentedTranslation Overview 7.x-2.0-beta1 also caused the problem in my case
Comment #26
good_man commentedThe patch missed one thing which is the 'module' key, otherwise drupal will assume the file is in drupal root dir. After applying the patch, no error messages anymore. Now let's see how testbot will react.
Comment #27
good_man commentedOne little effect, after changing the way you do menus in this module, other modules depending on it, like Translation Overview, needs an update, otherwise it won't work after applying this patch.
Comment #28
renat commentedPatch from #26 works fine for me. But I did not experienced any problems without it, so my result is not significant.
Comment #29
webcultist commented#26 seems to work for me, too.
Thanks
Comment #30
plach@good-man:
Thanks for working on this. The goal of the patch is to avoid the need for other modules to worry about ET, hence, unless I'm missing something, there should be no need to warn their maintainers.
Comment #31
good_man commentedI missed one 'module' key for the config page of ET (admin/config/regional/entity_translation) otherwise it'll display that fatal require_once error.
Re. Translation Overview, it's menu_alter() is executed before ET, therefore, ET will overwrite the previous TO path. Quoted from OT code:
So I think that it's now up to them to solve this @todo.
Comment #32
plachThe patch looks good, tests pass and I manually tested core node translation, i18n_node and translation overview successfully.
Thanks to everyone working on this! Committed to HEAD.
Comment #33
dhinakaran commented#31: et-1174242-31.patch queued for re-testing.
Comment #34
plachThe patch has been committed. No point in retesting it.
Comment #35
batigol commentedFatal error: Class name must be a valid object or a string in /home/prouser/drupal/sites/all/modules/entity_translation/entity_translation.module on line 495with latest dev:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in entity_translation_node_tab_access() (line 72 of \modules\entity_translation\entity_translation.node.inc).with alpha-1:
Comment #36
plachPlease open a new issue.
Comment #37
int_ua commentedWas it ever opened?
Update: Component was changed automatically due to "Code" not being available anymore.
Comment #38
int_ua commentedI've opened this: http://drupal.org/node/1541388
Comment #39
fxarte commentedIn my case, I got it working by enabling node entity in the config page: /admin/config/regional/entity_translation. For some reason taxonomy terms was the only entity type enabled. Version 7.x-1.0-alpha1
Thanks