Problem/Motivation

The config translation module tries to add a translate link to all entities. This causes a white screen on adding and then any further listing of custom blocks.

Steps to reproduce:
Install config_translation module, go to admin/structure/block/custom-blocks, add a custom block and you get the following error:
Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template "drupal:config-translation-overview" found for the "custom_block" entity type in Drupal\Core\Entity\Entity->urlInfo() (line 176 of core/lib/Drupal/Core/Entity/Entity.php).

Any further reload results in the same error.

Proposed resolution

In config_translation_entity_operation(), check if the link template "drupal:config-translation-overview" exists for the given entity.

Remaining tasks

Commit.

User interface changes

None.

API changes

None.

CommentFileSizeAuthor
#18 2256023-psr4-reroll.patch1.91 KBxjm
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,626 pass(es). View
#15 custom-block-translate-tab-2256023.2.patch1.99 KBolli
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,607 pass(es). View
#12 custom-block-translate-tab-2256023.2.patch1.99 KBlarowlan
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,658 pass(es), 1 fail(s), and 0 exception(s). View
#5 custom-block-translate-tab-2256023.pass_.patch1.92 KBlarowlan
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,665 pass(es). View
#5 custom-block-translate-tab-2256023.fail_.patch1.09 KBlarowlan
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,164 pass(es), 19 fail(s), and 3 exception(s). View
config_translation_link.patch787 bytesolli
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 69,948 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

larowlan’s picture

These should be translatable, so we need to add the annotation

olli’s picture

We already add the "drupal:content-translation-overview'" link template to custom_blocks in content_translation_entity_type_alter(), but the "translate" operation link is added only to nodes by content_translation_entity_operation_alter().

olli’s picture

Issue summary: View changes
larowlan’s picture

FileSize
1.09 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,164 pass(es), 19 fail(s), and 3 exception(s). View
1.92 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,665 pass(es). View

The real issue here is that we're using the config-entity-listing for content entities, so the fix is to make sure that the config_translation operation hook only fires on config-entities.

Should be red/green

The last submitted patch, 5: custom-block-translate-tab-2256023.fail_.patch, failed testing.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Oohh, that's a fairly bad oversight. Thanks for the fix.

The test changes could have used a comment so that we don't inadvertantly remove them later (to improve performance), but this is good to go nonetheless.

olli’s picture

Thank you, @larowlan!

Is there a problem with OP's proposed resolution using $entity->hasLinkTemplate()? (just curious)

tstoeckler’s picture

Status: Reviewed & tested by the community » Needs review

Hmm.. re #8: Good question! I thought about this some, and I think we should actually have both checks. config_translation fundamentally only works with config entities, it wouldn't work with anything else, but we should allow config entities to now provide a config-translation-overview link template and then they don't participate in config translation.

Thoughts?

larowlan’s picture

Yeah plus one to both checks

tstoeckler’s picture

Status: Needs review » Needs work

OK, let's do that then.

larowlan’s picture

Status: Needs work » Needs review
FileSize
1.99 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,658 pass(es), 1 fail(s), and 0 exception(s). View

Fixed

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Awesome, thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 12: custom-block-translate-tab-2256023.2.patch, failed testing.

olli’s picture

Status: Needs work » Needs review
FileSize
1.99 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,607 pass(es). View
olli’s picture

Status: Needs review » Reviewed & tested by the community
ngocketit’s picture

xjm’s picture

FileSize
1.91 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,626 pass(es). View
vijaycs85’s picture

+1 for RTBC. Thanks for fixing this issue. We got a duplicate already :) #2276477: WSOD on custom block creation / listing if config translation enabled

vijaycs85’s picture

Issue tags: +D8MI, +language-config, +sprint

Adding tags...

Gábor Hojtsy’s picture

Title: No link template "drupal:config-translation-overview" found for the "custom_block" » WSOD on custom block creation / listing if config translation enabled
Priority: Normal » Critical
Issue summary: View changes

WSOD of core modules is critical. Reusing the title of the other issue to underline the problem and elevating to critical. Also I think the subclass check is superfluous since the link template will only exist if it was already a subclass, but we can keep it there, if people want the code to look super safe.

catch’s picture

Status: Reviewed & tested by the community » Fixed

I think that's more explicit to have the subclass check.

To be honest I can't think of a module that's going to want to operate on both configuration and content entities identically - do we need to split that hook in two?

Committed/pushed to 8.x, thanks!

Gábor Hojtsy’s picture

Issue tags: -sprint

Yay, thanks. Not sure if we want to split that hook, but that is a possibility, yeah.

  • Commit abfc190 on 8.x by catch:
    Issue #2253735 by larowlan, olli, xjm: Fixed WSOD on custom block...

Status: Fixed » Closed (fixed)

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