Issue #1898424 by joelpittet, duellj, Cottser, mr.baileys | c4rl: [READY] layout.module - Convert PHPTemplate templates to Twig.

(as of #28)

Task

Convert PHPTemplate templates to Twig templates

Remaining


Template path Conversion status
core/modules/layout/layouts/static/one-col/one-col.tpl.php converted
core/modules/layout/layouts/static/twocol/two-col.tpl.php converted
core/modules/layout/tests/layouts/static/one-col/one-col.tpl.php converted
core/modules/layout/tests/themes/layout_test_theme/layouts/static/two-col/two-col.tpl.php converted

Testing steps

  1. Enable the Layout module
  2. Navigate to admin/structure/templates
  3. Compare the one- and two-column layout previews before and after applying the patch and clearing caches

#1757550: [Meta] Convert core theme functions to Twig templates
#1987510: [meta] Convert all core *.tpl.php templates to Twig as singular patch

Comments

c4rl’s picture

Issue tags: +Twig

Tagging

duellj’s picture

Status: Active » Needs review
StatusFileSize
new3.31 KB

Attached patch converts one-col.tpl.php and two-col.tpl.php to twig templates. Doesn't seem like much else needs to happen for converting this module to twig.

Status: Needs review » Needs work

The last submitted patch, 1898424-2-twig-layout.patch, failed testing.

duellj’s picture

Status: Needs work » Needs review
StatusFileSize
new3.57 KB

Ignore the patch from #2, left out the two column template conversion.

joelpittet’s picture

Status: Needs review » Needs work
Issue tags: +clean-up

@duellj great work that seems to be the ticket!

Needs a bit of docblock cleanup and it's RTBC
http://drupal.org/node/1823416

I think it's just the $'s and the [] and maybe some labeling
Available variables:
@ingroup themeable

duellj’s picture

Status: Needs work » Needs review
StatusFileSize
new2 KB
new3.76 KB

Thanks for the review @joelpittet.

I've cleaned up the docblocks and added in comments for the attributes variable.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new46.14 KB
new2.5 KB

Cool, I some manual testing and seems to do exactly as advertised. Nice work!

Just removed the whitespace error in the patch.

joelpittet’s picture

StatusFileSize
new716 bytes
new3.76 KB

Whoops, wrong patch files.

xjm’s picture

Issue tags: -clean-up, -Twig

#8: 1898424-7-twig-layout.patch queued for re-testing.

nikkubhai’s picture

Issue tags: +clean-up, +Twig

#8: 1898424-7-twig-layout.patch queued for re-testing.

star-szr’s picture

Status: Reviewed & tested by the community » Needs review

I think we should be converting these two templates as well:

core/modules/layout/tests/layouts/static/one-col/one-col.tpl.php
core/modules/layout/tests/themes/layout_test_theme/layouts/static/two-col/two-col.tpl.php

star-szr’s picture

Status: Needs review » Needs work

CNW for #11.

joelpittet’s picture

Assigned: Unassigned » joelpittet
Status: Needs work » Needs review
StatusFileSize
new7.61 KB
new4.02 KB

Conversions added from #13, thanks @Cottser for spotting those.

star-szr’s picture

That was quick, thanks @joelpittet :)

Minor docs tweaks and then I think we can go back to RTBC-land.

+++ b/core/modules/layout/layouts/static/one-col/one-col.html.twigundefined
@@ -0,0 +1,21 @@
+ * - content: An array of content, each item in the array is keyed to one

+++ b/core/modules/layout/layouts/static/twocol/two-col.html.twigundefined
@@ -0,0 +1,27 @@
+ * - content: An array of content, each item in the array is keyed to one

+++ b/core/modules/layout/tests/layouts/static/one-col/one-col.html.twigundefined
@@ -0,0 +1,20 @@
+ * - content: An array of content, each item in the array is keyed to one

+++ b/core/modules/layout/tests/themes/layout_test_theme/layouts/static/two-col/two-col.html.twigundefined
@@ -0,0 +1,26 @@
+ * - content: An array of content, each item in the array is keyed to one

Instead of "An array of content" how about "All content items", and instead of "each item in the array" how about "each content item"?

+++ b/core/modules/layout/layouts/static/twocol/two-col.html.twigundefined
@@ -0,0 +1,27 @@
+ * @ingroup: themeable

+++ b/core/modules/layout/tests/themes/layout_test_theme/layouts/static/two-col/two-col.html.twigundefined
@@ -0,0 +1,26 @@
+ * @ingroup: themeable

No colon after @ingroup.

joelpittet’s picture

StatusFileSize
new3.25 KB
new7.58 KB

Changes from #14

joelpittet’s picture

Issue summary: View changes

Add conversion summary table

star-szr’s picture

Issue summary: View changes

Update remaining

star-szr’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new3.16 KB
new7.58 KB

Performed manual testing (looks great) and added testing steps to summary. This patch only rewraps comments, so RTBC!

Great work @duellj and @joelpittet :)

star-szr’s picture

Issue summary: View changes

Add testing steps

star-szr’s picture

Issue summary: View changes

Tweak testing steps

star-szr’s picture

Issue summary: View changes

Remove sandbox link

c4rl’s picture

Title: Convert layout module to Twig » layout.module - Convert PHPTemplate templates to Twig

Per #1757550-44: [Meta] Convert core theme functions to Twig templates, retitling to indicate this issue applies to templates rather than theme_ functions (though there are no theme_ functions in this module).

c4rl’s picture

Issue summary: View changes

Updated issue summary.

joelpittet’s picture

Assigned: joelpittet » Unassigned
Issue tags: -clean-up
star-szr’s picture

Issue tags: +needs profiling

Tagging for profiling.

mr.baileys’s picture

Assigned: Unassigned » mr.baileys

Assigning to myself for profiling.

mr.baileys’s picture

All tests with Stark, disabled overlay, enabled APC class loader

For admin/structure/templates/manage/static_layout%3Alayout__two-col

=== 8.x..8.x compared (5199303f89141..519932b03de94):

ct  : 33,528|33,528|0|0.0%
wt  : 195,976|196,278|302|0.2%
cpu : 192,012|192,013|1|0.0%
mu  : 10,380,160|10,379,688|-472|-0.0%
pmu : 10,495,312|10,495,248|-64|-0.0%

=== 8.x..1898424 compared (5199303f89141..519932bf58536):

ct  : 33,528|33,902|374|1.1%
wt  : 195,976|213,117|17,141|8.7%
cpu : 192,012|196,012|4,000|2.1%
mu  : 10,380,160|10,558,752|178,592|1.7%
pmu : 10,495,312|10,672,888|177,576|1.7%

For admin/structure/templates/manage/static_layout:layout__one-col

=== 8.x..8.x compared (519936bfc0e17..519936e3ba473):

ct  : 33,499|33,499|0|0.0%
wt  : 193,018|193,700|682|0.4%
cpu : 188,012|192,012|4,000|2.1%
mu  : 10,375,416|10,375,416|0|0.0%
pmu : 10,487,768|10,487,768|0|0.0%

=== 8.x..1898424 compared (519936bfc0e17..51993708753db):

ct  : 33,499|33,873|374|1.1%
wt  : 193,018|211,519|18,501|9.6%
cpu : 188,012|200,012|12,000|6.4%
mu  : 10,375,416|10,554,456|179,040|1.7%
pmu : 10,487,768|10,668,264|180,496|1.7%

mr.baileys’s picture

Assigned: mr.baileys » Unassigned

Ignore above numbers, talked to @Cottser and I did not have a node displayed on the page.

star-szr’s picture

Assigned: Unassigned » star-szr

I'll run through this one, thanks @mr.baileys!

star-szr’s picture

Assigned: star-szr » Unassigned

Profiling is looking good on this one, not much fluctuation.

one-col template:

=== 8.x..8.x compared (519bea45d25a7..519beb006fe33):

ct  : 49,589|49,589|0|0.0%
wt  : 317,900|317,069|-831|-0.3%
cpu : 297,058|296,950|-108|-0.0%
mu  : 21,353,424|21,353,424|0|0.0%
pmu : 21,485,680|21,485,680|0|0.0%

http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519bea45d25a7&...

=== 8.x..layout-1898424-16 compared (519bea45d25a7..519beac12c1aa):

ct  : 49,589|49,672|83|0.2%
wt  : 317,900|318,232|332|0.1%
cpu : 297,058|298,208|1,150|0.4%
mu  : 21,353,424|21,383,296|29,872|0.1%
pmu : 21,485,680|21,517,080|31,400|0.1%

http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519bea45d25a7&...

two-col template

=== 8.x..8.x compared (519c10e55cf0a..519c113513469):

ct  : 49,628|49,628|0|0.0%
wt  : 319,561|318,978|-583|-0.2%
cpu : 298,990|298,655|-335|-0.1%
mu  : 21,357,040|21,357,040|0|0.0%
pmu : 21,492,696|21,492,696|0|0.0%

http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519c10e55cf0a&...

=== 8.x..layout-1898424-16 compared (519c10e55cf0a..519c116a1cb99):

ct  : 49,628|49,719|91|0.2%
wt  : 319,561|318,938|-623|-0.2%
cpu : 298,990|297,353|-1,637|-0.5%
mu  : 21,357,040|21,389,112|32,072|0.2%
pmu : 21,492,696|21,526,712|34,016|0.2%

http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=519c10e55cf0a&...

star-szr’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -needs profiling +Novice

Docs tweak please and then back to RTBC and ready to be alexpotted :)

+++ b/core/modules/layout/layouts/static/one-col/one-col.html.twigundefined
@@ -0,0 +1,21 @@
+ * - attributes: Attributes to be placed on the wrapping element.
+ * - content: All content items, each content item is keyed to one region of the
+ *   layout. This layout supports only one section:
+ *   - content.content: Content in the content column.

+++ b/core/modules/layout/layouts/static/twocol/two-col.html.twigundefined
@@ -0,0 +1,27 @@
+ * - content: All content items, each content item is keyed to one region of the
+ *   layout. This layout supports the following sections:
+ *   - content.first: Content in the first column.
+ *   - content.second: Content in the second column.

+++ b/core/modules/layout/tests/layouts/static/one-col/one-col.html.twigundefined
@@ -0,0 +1,20 @@
+ * - content: All content items, each content item is keyed to one region of the
+ *   layout. This layout supports the following sections:
+ *   - content.middle: The only region in the layout.

+++ b/core/modules/layout/tests/themes/layout_test_theme/layouts/static/two-col/two-col.html.twigundefined
@@ -0,0 +1,26 @@
+ * - content: All content items, each content item is keyed to one region of the
+ *   layout. This layout supports the following sections:
+ *   - content.left: Content in the left column.
+ *   - content.right: Content in the right column.

Can we please change all these so that we are not doing e.g. 'content.content', since we want indenting in a list to mean 'add a dot'. Along these lines I also suggest we be a bit more clear and say e.g. 'content' contains the following sections: instead of This layout supports the following sections:?

Thanks!

duellj’s picture

Status: Needs work » Needs review
StatusFileSize
new3.08 KB
new7.53 KB

Was this what you had in mind Cottser? I also changed the pluralization for the one column templates

star-szr’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Novice

Looks good to me, thanks @duellj!

alexpott’s picture

Title: layout.module - Convert PHPTemplate templates to Twig » [READY] layout.module - Convert PHPTemplate templates to Twig
Status: Reviewed & tested by the community » Closed (duplicate)
alexpott’s picture

Issue summary: View changes

Updated issue summary.

ianthomas_uk’s picture

Issue summary: View changes

Add commit message

alexpott’s picture

Title: [READY] layout.module - Convert PHPTemplate templates to Twig » layout.module - Convert PHPTemplate templates to Twig
Status: Closed (duplicate) » Fixed

Committed 43934a3 and pushed to 8.x. Thanks!

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

Anonymous’s picture

Issue summary: View changes

Got comment number wrong