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.
Problem/Motivation
Annotation of the Shortcut Entity Type contains a declaration of the translation handler. However, this is not necessary, because this handler will be added automatically by content_translation
module. According to the content_translation_entity_type_alter()
function comment:
If the entity paths match the default pattern above and there is no need for an entity-specific translation handler, Content Translation will provide built-in support for the entity.
Proposed resolution
Remove translation handler.
Remaining tasks
Review.
User interface changes
Nope.
API changes
Nope.
Data model changes
Nope.
Release notes snippet
Nope.
Comment | File | Size | Author |
---|---|---|---|
#14 | core-remove-default-translation-handler-3072929-14-D8.patch | 12.77 KB | id.aleks |
Comments
Comment #2
id.aleks CreditAttribution: id.aleks at Smile commentedPlease test and review
Comment #3
jibranSounds reasonable to me.
Comment #4
Wim LeersI see a dozen or so more of these in test entity types. Let's also remove those?
Comment #5
iyyappan.govindHi Wim Leers
I have removed the content translation handlers in test entity types also. Please review it. Thanks
Comment #6
iyyappan.govindSet to needs review
Comment #7
iyyappan.govindComment #9
id.aleks CreditAttribution: id.aleks as a volunteer and at Smile commented@iyyappan.govind
I think that removing content_translation module from the modules to enable list is wrong. Actually, this module is adding a translation handler to Shortcut Entity, which we are trying to remove. So in fact, your logic in the patch is wrong. Sorry for the straightforwardness.
@Wim Leers
I see that you changed the issue component to the entity system. Just to clarify: you want to remove all translation handlers that match the default paths pattern for all core entity types? If so, it makes sense for me and I will do this shortly.
Comment #10
id.aleks CreditAttribution: id.aleks as a volunteer and at Smile commented@Wim Leers
I have removed all declarations of the default translation handler. Affected CT`s are:
We had related issue Remove declaration of the translation handler for Media Entity. I decided to combine them and do all the works within this issue. That`s why you can see changes in the test for Media module.
Please test and review.
Comment #11
id.aleks CreditAttribution: id.aleks as a volunteer and at Smile commentedComment #12
id.aleks CreditAttribution: id.aleks as a volunteer and at Smile commentedComment #13
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedThe patch looks good to me, just a couple of points to fix:
The expected class needs to be the first argument passed to
assertEquals()
, and it should use theContentTranslationHandler::class
notation :)This test method can be removed, it only repeats the same assertion from above.
Comment #14
id.aleks CreditAttribution: id.aleks as a volunteer and at Smile commented@amateescu
1. I agree with you. It's fixed.
2. Fixed. It's my fault.
Please review. Thanks.
Comment #15
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedLooks great, thanks for the quick update!
Comment #16
alexpottCommitted f0e9115 and pushed to 8.8.x. Thanks!
AS the issue summary states setting the default is not necessary. Less boilerplate for the win!