This module makes it easy to add patterns, but it's difficult to edit them. If we had a template for each pattern, we could edit it in our IDE.

Comments

mortona2k created an issue. See original summary.

mortona2k’s picture

This patch adds a theme hook for template patterns and a template that prints {{ pattern|raw }} in place of {{ custom_pattern.pattern|raw }} in simple_styleguide.html.twig.

There should be no change with the regular use, but now we can add templates to override the pattern output. The pattern is available as a template variable.

I used the template name styleguide-pattern.twig. The template suggestions will convert underscores to dashes, but that's not the case when defined in hook_theme. If you use this naming pattern for the file, you don't have to specify the template name in hook_theme. I suggest removing it in the other definition and changing the filename for consistency.

mortona2k’s picture

Status: Active » Needs review
StatusFileSize
new2.89 KB

This one fixes the template source.

xpersonas’s picture

Good idea. I implemented your patch and suggestion with a bit of tweaking. It's up in the dev version now. Please review.

xpersonas’s picture

Been testing this without issue on multiple sites. Feature is implemented in version 1.7.

xpersonas’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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