Problem/Motivation

External entities with a UUID as ID or any ID containing characters not accepted by hook_theme_suggestions_HOOK() generate unusable template name suggestions. The template name suggestion doesn't work, and could be hard to figure out why. Twig debugging makes notice of this.

it looks like this when twig debugging is enabled:

<!--- 
   INVALID FILE NAME SUGGESTIONS:
   See https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!theme.api.php/function/hook_theme_suggestions_alter
   external_entity__b719a2fa-e401-4c97-b0b2-c33cb2a97693__full
   external_entity__b719a2fa-e401-4c97-b0b2-c33cb2a97693 
--->

Steps to reproduce

  1. Configure an external entity using a UUID or other form of ID with illegal template name characters
  2. Enable twig debugging
  3. Visit a page containing an external entity, like the detail page

Proposed resolution

sanitize the ID while generating theme suggestions.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pefferen created an issue. See original summary.

pefferen’s picture

Status: Active » Needs review
pefferen’s picture

adding patch file for use in composer