Problem/Motivation

According to the Twig documentation, Twig tags shouldn't output anything directly. Tags do something with or modify the tag's contents.

In #2821512: Create alternative to Twig include function to improve Drupal integration, we can see that the added {% theme %} tag was modeled after Twig's include tag.

However,Twig's include Tag docs have been updated to say:

The include function is semantically more "correct" (including a template outputs its rendered contents in the current scope; a tag should not display anything)

That note is describing why {{ include() }} is semantically more correct than {% include %}.

That means our theme function is semantic, but our theme tag is not.

Proposed resolution

We should remove the theme tag in favor of the theme function that already exists.

User interface changes

None.

API changes

Removes {% theme %} tag from 8.x-2.x. Marks it as deprecated in 8.x-1.x.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JohnAlbin created an issue. See original summary.

JohnAlbin’s picture

Status: Active » Needs review
FileSize
2.6 KB
JohnAlbin’s picture

FileSize
3.05 KB

  • JohnAlbin committed 7865cf9 on 8.x-2.x
    Issue #3090458 by JohnAlbin: Remove theme tag
    
JohnAlbin’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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