Task

Use Twig instead of PHPTemplate

Remaining

  • Replace all theme functions and templates with .html.twig equivalent templates
  • Add new preprocess functions for the .html.twig equivalent templates
  • Update all hook_theme definitions

Related

#1885560: [meta] Convert everything in theme.inc to Twig

Files: 
CommentFileSizeAuthor
#24 interdiff.txt4.16 KBshanethehat
#24 twig-link-1961876-23.patch5.54 KBshanethehat
PASSED: [[SimpleTest]]: [MySQL] 56,686 pass(es).
[ View ]
#19 interdiff.txt1.63 KBshanethehat
#19 twig-link-1961876-19.patch5.62 KBshanethehat
PASSED: [[SimpleTest]]: [MySQL] 55,767 pass(es).
[ View ]
#17 twig-link-1961876-17.patch4.14 KBshanethehat
FAILED: [[SimpleTest]]: [MySQL] 55,501 pass(es), 13 fail(s), and 6 exception(s).
[ View ]
#11 interdiff.txt35.86 KBjoelpittet
#11 1961876-11-twig-link.patch36.28 KBjoelpittet
PASSED: [[SimpleTest]]: [MySQL] 54,527 pass(es).
[ View ]
#9 1961876-9-twig-link.patch35.25 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] 54,611 pass(es), 7 fail(s), and 0 exception(s).
[ View ]
#9 interdiff.txt1.3 KBjoelpittet
#7 interdiff.txt35.31 KBjoelpittet
#7 1961876-6-twig-link.patch35.15 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] 54,466 pass(es), 8 fail(s), and 36 exception(s).
[ View ]
#3 1961876-twig-link.patch2.5 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] 53,931 pass(es), 10 fail(s), and 9 exception(s).
[ View ]

Comments

Status:Active» Postponed

Oops, status.

Status:Postponed» Active

As discussed on IRC, let's pick this back up again, rolling a patch combined with #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig so this is ready to go.

Issue tags:+Needs manual testing
StatusFileSize
new2.5 KB
FAILED: [[SimpleTest]]: [MySQL] 53,931 pass(es), 10 fail(s), and 9 exception(s).
[ View ]

First crack at this one. I didn't take much except most the docs from the sandbox. Hopefully that is ok. I used spaceless because of it's fancy little trick where it negates the newline at the end of the file and causes the tests to pass.

Could use some manual testing and review in general.

Status:Active» Needs review

Status:Needs review» Needs work

The last submitted patch, 1961876-twig-link.patch, failed testing.

Assigned:Unassigned» joelpittet
Status:Needs work» Needs review

Ok seeing as that failed, I rolled the same patch above with #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig to see how it fairs.

StatusFileSize
new35.15 KB
FAILED: [[SimpleTest]]: [MySQL] 54,466 pass(es), 8 fail(s), and 36 exception(s).
[ View ]
new35.31 KB

The interdiff on this is a bit silly (because it's #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig). But this comment has a patch attached... oOooo, ahhhh!

Status:Needs review» Needs work

The last submitted patch, 1961876-6-twig-link.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new1.3 KB
new35.25 KB
FAILED: [[SimpleTest]]: [MySQL] 54,611 pass(es), 7 fail(s), and 0 exception(s).
[ View ]

Tweaks but still fails on active link because it's not using l(), maybe I should move some of that logic to theme_link?

Status:Needs review» Needs work

The last submitted patch, 1961876-9-twig-link.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new36.28 KB
PASSED: [[SimpleTest]]: [MySQL] 54,527 pass(es).
[ View ]
new35.86 KB

Green!

Issue tags:-Needs manual testing

This is looking really good to. Manual tested:

Before Twig:

<a href="/node" class="custom-class" id="unique-id">Custom link</a>

After Twig:

<a href="/node" class="custom-class" id="unique-id">Custom link</a>

Assigned:joelpittet» Unassigned

Status:Needs review» Postponed

Looks good, but surely postponed on the patch it incorporates being committed first.

Status:Needs work» Needs review
StatusFileSize
new4.14 KB
FAILED: [[SimpleTest]]: [MySQL] 55,501 pass(es), 13 fail(s), and 6 exception(s).
[ View ]

Rerolled

Status:Needs review» Needs work

The last submitted patch, twig-link-1961876-17.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new5.62 KB
PASSED: [[SimpleTest]]: [MySQL] 55,767 pass(es).
[ View ]
new1.63 KB

oops, somehow missed a whole function

Status:Needs review» Needs work
Issue tags:-Twig

The last submitted patch, twig-link-1961876-19.patch, failed testing.

Status:Needs work» Needs review
Issue tags:+Twig

#19: twig-link-1961876-19.patch queued for re-testing.

Tests pass locally, I suspect random failure.

Status:Needs review» Needs work

@shanethehat - please don't use url_is_active() and please do statically cache the function calls used to detect the link's active status and please do optimise the logic of the active checks to stop comparing variables once we know there's no match.

see comments #106 through to #122 at #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig for an explanation of all of this :)

Status:Needs work» Needs review
StatusFileSize
new5.54 KB
PASSED: [[SimpleTest]]: [MySQL] 56,686 pass(es).
[ View ]
new4.16 KB

As discussed on IRC, this is essentially a copy/paste of the part of l() that handles the determination of 'active'. It's an unpleasant duplication that should be resolved by #1985974: Make l() optionally return structured output

Status:Needs review» Closed (duplicate)

Theme link was removed, there's nothing to convert any more.

Issue summary:View changes

Update summary