Issue #1843772 by joelpittet, steveoliver, 2ndmile, Cottser | tostinni: Convert views-ui-display-tab-bucket.tpl.php to Twig.

Meta issue: #1898472: [meta] Convert views_ui module to Twig
#1987510: [meta] Convert all core *.tpl.php templates to Twig as singular patch

Manual testing steps:

1. Edit a view
2. A tab bucket is the wrapper around a set of zebra striped options with a title on the view edit page

Profiling results

=== 8.x..8.x compared (5198f0bb880ef..5198f219706e9):

ct  : 61,482|61,482|0|0.0%
wt  : 316,970|316,924|-46|-0.0%
cpu : 277,976|278,191|215|0.1%
mu  : 16,466,872|16,466,872|0|0.0%
pmu : 16,725,408|16,725,408|0|0.0%

http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=5198f0bb880ef&...

=== 8.x..views-ui-display-tab-bucket-1843772-25 compared (5198f0bb880ef..5198f1db1bc51):

ct  : 61,482|61,996|514|0.8%
wt  : 316,970|318,571|1,601|0.5%
cpu : 277,976|280,193|2,217|0.8%
mu  : 16,466,872|16,495,480|28,608|0.2%
pmu : 16,725,408|16,763,776|38,368|0.2%

http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=5198f0bb880ef&...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joelpittet’s picture

Status: Active » Needs review
FileSize
995 bytes

first draft, hope I got the path correct

mbrett5062’s picture

Issue tags: +VDC

Tagging.

jpamental’s picture

Status: Needs review » Reviewed & tested by the community

Applies cleanly, works as advertised.

dawehner’s picture

Status: Reviewed & tested by the community » Needs review

Back to needs review due to missing documentation of variables, sorry.

steveoliver’s picture

Project: » Drupal core
Version: » 8.x-dev
Component: Twig templates conversion (front-end branch) » views_ui.module
FileSize
2.61 KB

Swaps out .tpl.php with .html.twig, removing one call to drupal_render() in preprocess and adding comments to the template.

steveoliver’s picture

Title: Convert views/views_ui/theme/views-ui-display-tab-bucket.tpl.php to twig » Convert views-ui-display-tab-bucket.tpl.php to Twig
dawehner’s picture

Thanks for helping!

Is there a reason why we reorder the variables?

joelpittet’s picture

Issue tags: +Twig

No idea why I did that, usually OCD on those things. @dawehner want me to reroll that in the previous order? we can probably do just {{ attributes }} now as well because we decided that the class breakout would be examples for bartik theme.

joelpittet’s picture

Ok removed the class split out and put the actions back in there place.

star-szr’s picture

Title: Convert views-ui-display-tab-bucket.tpl.php to Twig » Convert views/views_ui/templates/views-ui-display-tab-bucket.tpl.php to Twig

Retitling.

dawehner’s picture

+++ b/core/modules/views/views_ui/templates/views-ui-display-tab-bucket.html.twigundefined
@@ -0,0 +1,26 @@
+ * Template for each "box" on the display query edit screen.

Sorry for this nitpick: Should be "Default theme implementation ...".

+++ b/core/modules/views/views_ui/templates/views-ui-display-tab-bucket.html.twigundefined
@@ -0,0 +1,26 @@
+  {% if title -%}
...
+  {%- endif %}

Not sure whether I asked that before. What was "-" used for?

joelpittet’s picture

Assigned: Unassigned » joelpittet
FileSize
2.1 KB
2.84 KB

Did doc updates from #11 and preprocess doc cleanup.

@dawehner: {%- and {{- are whitespace modifiers
@see http://twig.sensiolabs.org/doc/templates.html#whitespace-control

star-szr’s picture

Issue tags: +Needs manual testing

Tagging.

joelpittet’s picture

Assigned: joelpittet » Unassigned
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

perfect! The views UI still works as expected.

star-szr’s picture

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

Thanks @dawehner :) tagging as a Novice task for these minor docs tweaks, then back to RTBC.

+++ b/core/modules/views/views_ui/templates/views-ui-display-tab-bucket.html.twigundefined
@@ -0,0 +1,26 @@
+ * - title: The title of the bucket, i.e "Fields", "Filter Criteria", etc.

i.e should be e.g. in this case.

+++ b/core/modules/views/views_ui/views_ui.theme.incundefined
@@ -38,6 +38,16 @@ function template_preprocess_views_ui_display_tab_setting(&$variables) {
+ * Prepares variables for views ui display tab bucket templates.

I think we've been capitalizing Views and Views UI.

+++ b/core/modules/views/views_ui/views_ui.theme.incundefined
@@ -51,7 +61,7 @@ function template_preprocess_views_ui_display_tab_bucket(&$variables) {
-  $variables['actions'] = !empty($element['#actions']) ? render($element['#actions']) : '';
+  $variables['actions'] = !empty($element['#actions']) ? $element['#actions'] : '';

If '#actions' is a render element, the default should be array() instead of an empty string.

2ndmile’s picture

Assigned: Unassigned » 2ndmile

I will take it.

2ndmile’s picture

Status: Needs work » Needs review
FileSize
1.69 KB
2.85 KB

Changes from #16 implemented. Please review.

star-szr’s picture

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

Looks good, thanks @2ndmile!

joelpittet’s picture

Assigned: 2ndmile » Unassigned
FileSize
780 bytes
3.08 KB

Fixing attribute title for overridden display tab buckets.

joelpittet’s picture

fix for #20 at #1484704: Remove instances of attributes_array needs re-roll once that get in.

Fabianx’s picture

Issue tags: -Twig, -VDC

Status: Reviewed & tested by the community » Needs work
Issue tags: +Twig, +VDC

The last submitted patch, 1843772-20-twig-views-ui-tab-bucket.patch, failed testing.

star-szr’s picture

Assigned: Unassigned » star-szr

I'm on it.

star-szr’s picture

Assigned: star-szr » Unassigned
Status: Needs work » Needs review
FileSize
3.02 KB

Rerolled. The Views UI module got moved to core/modules in #1820414: CHANGE NOTICE: Move views_ui.module directly into /core/modules/.

star-szr’s picture

Issue summary: View changes

Update to point to right meta issue

star-szr’s picture

Issue tags: +needs profiling

Tagging for profiling.

thedavidmeister’s picture

Issue tags: +Needs manual testing

I don't think this ever got tested properly. Patch looks good from a code standards POV though.

thedavidmeister’s picture

Assigned: Unassigned » thedavidmeister

testing

thedavidmeister’s picture

ah, a "tab bucket" is a zebra striped collection of settings with a title on the view edit page.

thedavidmeister’s picture

Issue summary: View changes

Updated issue summary.

thedavidmeister’s picture

Assigned: thedavidmeister » Unassigned
Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs manual testing

HEAD:

<div  class="views-ui-display-tab-bucket format">
<h3>Format</h3>
<div class="views-display-setting views-ui-display-tab-setting defaulted odd clearfix" >
<span class="label">Format:</span>
<a href="/d8html/admin/structure/views/nojs/display/frontpage/page_1/style" class="views-ajax-link " title="Change the way content is formatted." id="views-page-1-style">Unformatted list</a>
<span class="label">&nbsp;|&nbsp;</span>
<a href="/d8html/admin/structure/views/nojs/display/frontpage/page_1/style_options" class="views-ajax-link views-button-configure" title="Change settings for this format" id="views-page-1-style-options">
<span>Settings</span>
</a>
</div>
<div class="views-display-setting views-ui-display-tab-setting defaulted even clearfix" >
<span class="label">Show:</span>
<a href="/d8html/admin/structure/views/nojs/display/frontpage/page_1/row" class="views-ajax-link " title="Change the way each row in the view is styled." id="views-page-1-row">Fields</a>
<span class="label">&nbsp;|&nbsp;</span>
<a href="/d8html/admin/structure/views/nojs/display/frontpage/page_1/row_options" class="views-ajax-link views-button-configure" title="Change settings for this style" id="views-page-1-row-options">
<span>Settings</span>
</a>
</div>
</div>

post-patch:

<div class="views-ui-display-tab-bucket format">
<h3>Format</h3>
<div class="views-display-setting views-ui-display-tab-setting defaulted odd clearfix" >
<span class="label">Format:</span>
<a href="/d8html/admin/structure/views/nojs/display/frontpage/page_1/style" class="views-ajax-link " title="Change the way content is formatted." id="views-page-1-style">Unformatted list</a>
<span class="label">&nbsp;|&nbsp;</span>
<a href="/d8html/admin/structure/views/nojs/display/frontpage/page_1/style_options" class="views-ajax-link views-button-configure" title="Change settings for this format" id="views-page-1-style-options">
<span>Settings</span>
</a>
</div>
<div class="views-display-setting views-ui-display-tab-setting defaulted even clearfix" >
<span class="label">Show:</span>
<a href="/d8html/admin/structure/views/nojs/display/frontpage/page_1/row" class="views-ajax-link " title="Change the way each row in the view is styled." id="views-page-1-row">Fields</a>
<span class="label">&nbsp;|&nbsp;</span>
<a href="/d8html/admin/structure/views/nojs/display/frontpage/page_1/row_options" class="views-ajax-link views-button-configure" title="Change settings for this style" id="views-page-1-row-options">
<span>Settings</span>
</a>
</div>
</div>

diff:

--- /Users/thedavidmeister/tmp/diff/new-mod 
+++ /Users/thedavidmeister/tmp/diff/original-mod 
@@ -1,4 +1,4 @@
-<div class="views-ui-display-tab-bucket format">
+<div  class="views-ui-display-tab-bucket format">
 <h3>Format</h3>
 <div class="views-display-setting views-ui-display-tab-setting defaulted odd clearfix" >
 <span class="label">Format:</span>

Twig conversion fixes a double space in the wrapper div and everything else is identical. Setting back to RTBC.

star-szr’s picture

Assigned: Unassigned » star-szr

Dibs on this for profiling.

star-szr’s picture

Assigned: star-szr » Unassigned
Issue tags: -needs profiling

Profiling results for editing frontpage view:
/admin/structure/views/view/frontpage/edit

=== 8.x..8.x compared (5198f0bb880ef..5198f219706e9):

ct  : 61,482|61,482|0|0.0%
wt  : 316,970|316,924|-46|-0.0%
cpu : 277,976|278,191|215|0.1%
mu  : 16,466,872|16,466,872|0|0.0%
pmu : 16,725,408|16,725,408|0|0.0%

http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=5198f0bb880ef&...

=== 8.x..views-ui-display-tab-bucket-1843772-25 compared (5198f0bb880ef..5198f1db1bc51):

ct  : 61,482|61,996|514|0.8%
wt  : 316,970|318,571|1,601|0.5%
cpu : 277,976|280,193|2,217|0.8%
mu  : 16,466,872|16,495,480|28,608|0.2%
pmu : 16,725,408|16,763,776|38,368|0.2%

http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=5198f0bb880ef&...

star-szr’s picture

Issue summary: View changes

updated issue summary

alexpott’s picture

Title: Convert views/views_ui/templates/views-ui-display-tab-bucket.tpl.php to Twig » [READY] Convert views/views_ui/templates/views-ui-display-tab-bucket.tpl.php to Twig
Status: Reviewed & tested by the community » Closed (duplicate)
alexpott’s picture

Issue summary: View changes

Add profiling results

alexpott’s picture

Title: [READY] Convert views/views_ui/templates/views-ui-display-tab-bucket.tpl.php to Twig » Convert views/views_ui/templates/views-ui-display-tab-bucket.tpl.php to Twig
Status: Closed (duplicate) » Fixed

Committed 298d1fd and pushed to 8.x. Thanks!

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

Anonymous’s picture

Issue summary: View changes

Updated issue summary -- add git commit message.