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.
If, using entity translation, I create a new translation of an FPP, but leave it unpublished, everyone can see this translation regardless of permissions.
Comment | File | Size | Author |
---|---|---|---|
#1 | 1931678-fpp_unpublished_translation-1.patch | 961 bytes | dalin |
Comments
Comment #1
dalinentity_translation_field_language_alter()
checks whether the user has access to a translation. It first calls$handler->getTranslations()
to load all the translation data. In the case of FPP this returns:Whereas for a node we have
Looking deeper the inconsistency happens in
EntityTranslationDefaultHandler->getTranslations()
Since
$this->entity->{$translations_key}
is in fact set.The attached patch overrides this method to instead check
$this->entity->{$translations_key}->original
I'm not sure if this data actually needs to be added earlier in the process.
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedIs this a side effect of entity caching? I can't think of any other reason that hook_entity_load would not be used.
Comment #4
DamienMcKennaComment #5
mglamandalin, can you provide testing instructions? Did you have Entity cache module enabled? Also, any chance this could have been a bug in Entity Translation itself?
Comment #6
dalin90% chance that entity caching was in use on the site where I found the bug. But I have no idea what site I was working on at the time.
Comment #7
mglamanI'm voting for taking this off of 1.6 release punch list, just because it might be "cannot reproduce" and was an entitycache bug or even in entity translation.
Comment #8
DamienMcKennaAm taking this off the 1.6 list and it may in fact be a "by design" thing. FPPs don't have a status, so there's no way of marking one as being unpublished, so I suspect that's at play here.