Problem/Motivation

After making changes to the content translation settings, the cached bundles are not cleared.

To reproduce:

1. Create a node for article on a new site
2. Enable translation or article bundle
3. Go to the node

The translate tab is not visible.

That's because the generic entity API checks the translate flag in the bundle information, which is only updated after their cache is cleared.

Proposed resolution

Clear cached bundles after making changes to the content translation settings.

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Title: No cache clear after settings change » Bundle cache is not invalidated after changing translation settings
Issue summary: View changes
Issue tags: +D8MI, +language-content
sasanikolic’s picture

Status: Active » Needs review
FileSize
728 bytes
sasanikolic’s picture

Better solution... Tried reproducing and it works.

Berdir’s picture

Issue tags: +Needs tests

Status: Needs review » Needs work

The last submitted patch, 3: bundle_cache_is_not-2450251-3.patch, failed testing.

alexpott’s picture

The last submitted patch, 6: 2450251.6.test-only.patch, failed testing.

Berdir’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Test looks good to me.

xjm’s picture

Status: Reviewed & tested by the community » Needs review

So this is a clear bugfix, and it makes sense to reset the cache after doing stuff. However, #2419649: Content translation schema updates are not triggered consistently moved the rebuild from the end of that submit handler up to its current location in HEAD. This reverts that. Can we look into why and at least document that we're not reverting something that the other issue didn't sufficiently test?

alexpott’s picture

Status: Needs review » Reviewed & tested by the community

I've repeated the steps outlined in the issue summary of #2419649: Content translation schema updates are not triggered consistently and the fail reported in step 6 does not occur with this patch applied. Also that patch added a test which this is not causing to fail.

xjm’s picture

Status: Reviewed & tested by the community » Needs work

Thanks @alexpott.

+++ b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php
@@ -124,6 +116,17 @@ public function testContentTranslationContextualLinks() {
+    // Set up the node type and field to be translatable through the UI.

So the test coverage here relies on not clearing the cache programmatically in the test, and using the UI to do the configuration. Can we expand this comment to document this more clearly, so that someone in the future doesn't "optimize" things by converting this to API calls? (Since there are no assertions in the hunk.)

Sorry for not thinking of this in the previous review.

alexpott’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
1.59 KB
7.08 KB

Sure np. And in fact we can remove more of the API calls than I originally saw.

Setting straight back to rtbc since only removing code from a test and adding a comment.

xjm’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
9.19 KB
1.49 KB

Sorry, the attached is what I meant. The comment addition in #12 still doesn't stop someone from removing the drupalPostForm() call to make the test faster (and it's a little confusing), but adding a comment right above the drupalPostForm() would. "Translatable through the UI" was also ambiguous and confused me on first read -- it is intended to mean "use the UI to make it translatable" but could be read as "make it so the UI can be used to translate it".

Status: Needs review » Needs work

The last submitted patch, 13: 2450251-13.patch, failed testing.

xjm’s picture

FileSize
7.01 KB

Same interdiff from #12, just with a non-bogus patch.

xjm’s picture

Status: Needs work » Needs review
alexpott’s picture

FileSize
1.47 KB
5.54 KB

In #12 I introduced some parts of another patch :(

Thanks for fixing the comment @xjm.

jibran’s picture

+++ b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php
@@ -124,6 +110,18 @@ public function testContentTranslationContextualLinks() {
+    // Use a UI form sumission to make the node type and field translatable.

Shouldn't it be submission?

alexpott’s picture

FileSize
904 bytes
5.54 KB

@jibran good spot.

The last submitted patch, 17: 2450251-xjm.17.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 19: 2450251-xjm.19.patch, failed testing.

alexpott’s picture

Status: Needs work » Needs review
FileSize
1.38 KB
4.16 KB

More unrelated patch to remove. alexpott--

jibran’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @alexpott for fixing the patch. Back to RTBC.

xjm’s picture

Status: Reviewed & tested by the community » Fixed

I don't know why my login is in the name of this patch, but @amateescu convinced me yesterday it's okay for me to commit it. Normal bugfix, so prioritized during the beta. Committed and pushed to 8.0.x, thanks!

  • xjm committed 2bb91de on 8.0.x
    Issue #2450251 by alexpott, xjm, sasanikolic, Berdir: Bundle cache is...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.