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.
According to Gabor we absolutely need a language selection widget on every entity edit form. I think this might be problematic in some situations, e.g. when creating terms through a node taxonomy field, hence we need some kind of fall back strategy.
Comments
Comment #1
plachRelated issue: #1393790: Default language of the comment, the taxonomy terms and file entities.
Comment #2
plachWorking on this.
Comment #3
plachHere is a first attempt. To do:
Let's see if the bots complains.
Comment #4
plachImplemented per-language settings. Only field reordering is missing.
Comment #5
plachEt voilà. I think now we need only an update function to keep BC.
Comment #6
bforchhammer CreditAttribution: bforchhammer commentedI'll try to test+review this soon... :)
Comment #7
bforchhammer CreditAttribution: bforchhammer commentedPatch #5 summary of changes:
This is the new settings screen:
The new settings are currently also applied to entities which have ET disabled! Is that intended?
Patch #5 code review
I think that this variable should be split into separate
entity_translation_settings_TYPE__BUNDLE
variables; having only one variable makes it hard to e.g. export settings for only a few selected content types. There was a similar issue in core with thefield_bundle_settings
variable, see this change notice.It would be cool if it was also possible to provide global or entity defaults, and override them on the bundle level. (Personally I'd probably almost always use "current language" and "show selector".) However, as far as I know core doesn't do something like this anywhere either, so definitely not required.
The keys could (should?) be moved into constants so that we don't have to juggle strings...
Are these changes required for the language selector? What's their effect on the permissions tests in #1770750: Improve test coverage?.
These changes make me wonder whether it would be good for developers to attach all ET form handlers in one place... so maybe we should also move the #submit handler into
hook_form_alter()
? Not sure.This change is causing notices with the bean module (bean translation handler), because it relies on having a properly loaded entity:
Undefined property: stdClass::$delta in EntityTranslationBeanHandler->getEntityId()
This will need a follow-up issue...Maybe we should also add a respective comment to the handler interface docs, saying that the entity might only be a stub entity.
Not sure what this comment is trying to tell me :)
@plach: great work on the patch! I can see the beta release coming closer and closer... :)
Comment #8
bforchhammer CreditAttribution: bforchhammer commentedAnother minor todo: the new
entity_translation_settings
variable should be deleted inhook_uninstall()
.Comment #9
plachI think we should be ready to go now.
Comment #10
plachEr, I missed #7. Hopefully some of the issues were fixed by #9. Here is an interdiff.
Basically I added an update function and new entity info stuff to provide better BC. BTW now we have per-bundle translation.
Comment #11
plachThis plus #9 should fix #7 except for:
Makes sense but I'd leave that for a follow-up. This patch is already doing too much ;)
Btw I want also the other settings (fallback, ...) to be per-bundle.
Well, yes, now we can assign LANGUAGE_NONE to any entity type so we have to account for that when deciding whether displaying the translate tab.
Well, the validation handler is a hack and is really hardcoded logic, while the submission handlers should be overridable, if needed, by the specialized translation handlers. I'd leave this as is.
Not sure where, honestly.
Comment #12
plachI want to merge my topic branch so please don't commit any patch here.
Comment #13
plachLast one: fixed a bug introduced by #11 and adds an option to exclude
LANGUAGE_NONE
from the available languages.Comment #14
plachJust posted a new patch in #1495570: Update Entity translation integration which relies on this. It would be good to commit this and then get it RTBC ASAP, since the new Commerce release should be out on October 5th. Testing the patch spawned a couple of new issues:
#1798456: Hide shared form elements when the user has not the related permission
#1798460: Make the translate operation contextual
Comment #15
bforchhammer CreditAttribution: bforchhammer commentedAwesome! Patch looks good to me.
Minor documentation issues:
"Impossible" has an "i" too much.
I think these doc blocks can be removed. ;)
Comment #16
plachFixed #15, committed and pushed, thanks!
Now we should really focus on getting #1495570: Update Entity translation integration RTBC :)
Comment #17
plachThis will need test coverage.
Comment #18
bforchhammer CreditAttribution: bforchhammer commentedFollow-up issue for bean module: #1799776: Fix entity translation regressions