Task

Use Twig instead of theme function

Remaining

  • Replace all theme functions with .html.twig equivalent templates
  • Add new preprocess functions for the .html.twig equivalent templates
  • Update all hook_theme definitions
CommentFileSizeAuthor
#108 convert-1963978-108.patch7.57 KBNickDickinsonWilde
#105 interdiff-1963978-99-101.txt839 bytesjmolivas
#105 convert-1963978-101.patch7.55 KBjmolivas
#99 interdiff-1963978-77-99.txt532 bytesjmolivas
#99 convert-1963978-99.patch7.53 KBjmolivas
#89 convert-1963978-77.patch7.19 KBjoelpittet
#84 filter-criterion.png230.17 KBjmolivas
#84 interdiff-1963978-77-84.txt30.15 KBjmolivas
#84 convert-1963978-84.patch32.61 KBjmolivas
#78 after-grouped-exposed-filter.png119.65 KBjoelpittet
#78 before-grouped-expose-filter.png113.4 KBjoelpittet
#78 after.txt56.29 KBjoelpittet
#78 before.txt64.02 KBjoelpittet
#77 convert-1963978-77.patch7.19 KBjoelpittet
#77 interdiff.txt1.32 KBjoelpittet
#76 interdiff.txt1.98 KBjoelpittet
#76 convert-1963978-76.patch6.43 KBjoelpittet
#75 convert-1963978-75.patch5.44 KBjoelpittet
#75 interdiff.txt2.04 KBjoelpittet
#74 interdiff.txt1.03 KBjoelpittet
#74 convert-1963978-74.patch5.75 KBjoelpittet
#73 convert-1963978-73.patch5.8 KBjoelpittet
#70 convert-1963978-70.patch7.21 KBNickDickinsonWilde
#68 Screenshot 2015-05-28 00.46.15.png147.19 KBNickDickinsonWilde
#68 convert-1963978-68.patch7.21 KBNickDickinsonWilde
#64 convert-1963978-64.patch7.26 KBNickDickinsonWilde
#60 convert-1963978-59.patch7.26 KBNickDickinsonWilde
#58 convert-1963978-58.patch7.26 KBNickDickinsonWilde
#49 convert-1963978-49.patch7.29 KBNickDickinsonWilde
#46 convert-1963978-44.patch8.54 KBNickDickinsonWilde
#43 convert-1963978-42.patch8.85 KBNickDickinsonWilde
#41 convert-1963978-41.patch8.38 KBNickDickinsonWilde
#38 convert-1963978-38.patch6.58 KBdimaro
#38 interdiff-1963978-35-38.txt996 bytesdimaro
#35 convert-1963978-35.patch6.56 KBjoelpittet
#30 convert-1963978-30.patch6.8 KBjoelpittet
#28 Files__File____Site-Install.png62.87 KBjoelpittet
#23 convert-1963978-23.patch6.84 KBManuel Garcia
#19 convert-1963978-19.patch6.89 KBjoelpittet
#19 interdiff.txt7.81 KBjoelpittet
#18 1963978-18.patch8.7 KBlauriii
#11 1963978-11-twig-views-ui-build-group-filter.patch9 KBjoelpittet
#11 interdiff.txt2.5 KBjoelpittet
#7 twig-views-ui-build-group-filter-form-1963978-6.patch8.88 KB2ndmile
#5 twig-views-ui-build-group-filter-form-1963978-5.patch8.87 KBjoelpittet
#2 twig-views-ui-build-group-filter-form-1963978-2.patch8.36 KBjoelpittet
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

star-szr’s picture

Issue tags: +Needs manual testing

Tagging.

joelpittet’s picture

Status: Active » Needs review
Issue tags: -Needs manual testing
FileSize
8.36 KB

Split from meta

joelpittet’s picture

Issue tags: +Needs manual testing

Damn it's like tag caching or something... get back in there!

Status: Needs review » Needs work

The last submitted patch, twig-views-ui-build-group-filter-form-1963978-2.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
FileSize
8.87 KB

Wrong twig file from split.

star-szr’s picture

Status: Needs review » Needs work
Issue tags: +Novice, +Needs reroll
2ndmile’s picture

Status: Needs work » Needs review
FileSize
8.88 KB

Reroll of #5 - please make sure I did this correctly as this is my first contribution.

star-szr’s picture

Issue tags: -Novice, -Needs reroll

Reroll looks great, thank you @2ndmile!

thedavidmeister’s picture

Issue tags: +@todo clean-up

Review for #7:

Awful lot of undocumented variables with @todo in the Twig template here. Not sure if this should prevent an RTBC status considering the nature of the patch but I've added a "@todo clean-up" tag.

+ * - table: A rendered table element of the group filter form..

Don't need the double dot at the end.

+ '#attributes' => array('class' => array('views-filter-groups'), 'id' => 'views-filter-groups'),

This line is part of a multi-line array and it is over 80 characters itself. Looks like it should probably be split over multiple lines itself.

+ 'class' => array('views-hidden', 'views-button-remove', 'views-groups-remove-link', 'views-remove-link'),

+ $variables['table']['#rows'][] = array('data' => $data, 'id' => 'views-row-' . $group_id, 'class' => array('draggable'));

More long arrays that could be split across multiple lines.

+ $remove_link = array(

Indentation is wrong here.

+ '#theme' => 'link',

Including this means that this patch can't be RTBC until #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig lands.

This patch is tagged as "needs manual testing" but there are no manual testing steps included in the issue summary - these need to be written and somebody needs to do the manual testing.

thedavidmeister’s picture

Status: Needs review » Needs work
joelpittet’s picture

Status: Needs work » Needs review
FileSize
2.5 KB
9 KB

Did the doc cleanup from #9 thank you @thedavidmeister! :)

tim.plunkett’s picture

+++ b/core/modules/views/views_ui/views_ui.theme.incundefined
@@ -115,40 +115,68 @@ function theme_views_ui_expose_filter_form($variables) {
+  $variables['form_description'] = $form['form_description'];
+  $variables['expose_button'] = $form['expose_button'];
+  $variables['group_button'] = $form['group_button'];
+  unset($form['form_description']);
+  unset($form['expose_button']);
+  unset($form['group_button']);
+
   if (isset($form['required'])) {
-    $output .= drupal_render($form['required']);
+    $variables['required'] = $form['required'];
+    unset($form['required']);
   }
...
+  if (isset($form['operator'])) {
+    $variables['operator'] = $form['operator'];
+    unset($form['operator']);
...
+  if (isset($form['value'])) {
+    $variables['value'] = $form['value'];
+    unset($form['value']);
...
+  $variables['optional'] = $form['optional'];
+  $variables['remember'] = $form['remember'];
+  unset($form['optional']);
+  unset($form['remember']);
+
+  $variables['widget'] = $form['widget'];
+  $variables['label'] = $form['label'];
+  $variables['description'] = $form['description'];
+  unset($form['widget']);
+  unset($form['label']);
+  unset($form['description']);

Instead of all of this, why not just:

$keys = array(
  'form_description',
  'expose_button',
  'group_button',
  'required',
  'operator',
  'value',
  'optional',
  'remember',
  'widget',
  'label',
  'description',
);
foreach ($keys as $key) {
  if (isset($form[$key])) {
    $variables[$key] = $form[$key];
    unset($form[$key]);
  }
}
+++ b/core/modules/views/views_ui/views_ui.theme.incundefined
@@ -168,20 +198,69 @@ function theme_views_ui_build_group_filter_form($variables) {
+  unset($form['group_items']);
+  unset($form['default_group']);
+  unset($form['default_group_multiple']);
+
+  $variables['add_group'] = $form['add_group'];
+  $variables['more'] = $form['more'];
+  unset($form['add_group']);
+  unset($form['more']);

Oh these too.

star-szr’s picture

Assigned: Unassigned » star-szr
Status: Needs review » Needs work

#12/@tim.plunkett - That would certainly be cleaner, thank you :) I think this whole thing can be refactored ala #1898432-54: node.module - Convert PHPTemplate templates to Twig. Probably no need to prepare all those variables in preprocess (other than 'table' from what I can see at a glance).

Should be able to just use e.g. {{ form.more }} in the template.

I'll investigate.

damiankloip’s picture

See #1984850: Convert FilterPluginBase::build_group_form to use table rendering and remove theme function. It's likely that all views ui forms will get a conversion issue. There have been a few already.

star-szr’s picture

Assigned: star-szr » Unassigned
Status: Needs work » Closed (won't fix)

@damiankloip - thank you! It looks like this will be fully converted by #1984850: Convert FilterPluginBase::build_group_form to use table rendering and remove theme function.

star-szr’s picture

Issue summary: View changes

Remove sandbox link

star-szr’s picture

Issue summary: View changes
Status: Closed (won't fix) » Needs work

Since #1984850: Convert FilterPluginBase::build_group_form to use table rendering and remove theme function is no longer removing that theme function, it seems we should reactivate this issue and just get it converted to Twig.

lauriii’s picture

Assigned: Unassigned » lauriii
lauriii’s picture

Status: Needs work » Needs review
FileSize
8.7 KB

Rerolled the patch

joelpittet’s picture

Issue tags: +Novice
FileSize
7.81 KB
6.89 KB

Refactored this to clean it up from the older patch. Fixed #theme link which is now #type=>link.

Did most of the @todo's but left a couple in there. Maybe someone can test this and fix those @todo.

Status: Needs review » Needs work

The last submitted patch, 19: convert-1963978-19.patch, failed testing.

realityloop’s picture

Issue tags: +Amsterdam2014, +Needs reroll
Manuel Garcia’s picture

Assigned: lauriii » Manuel Garcia

Rerolling the patch...

Manuel Garcia’s picture

Assigned: Manuel Garcia » Unassigned
Status: Needs work » Needs review
FileSize
6.84 KB

Here is #19 rerolled.

dawehner’s picture

  1. +++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
    @@ -0,0 +1,71 @@
    +{{ form|without(
    +  'form_description',
    +  'expose_button',
    +  'group_button',
    +  'required',
    +  'operator',
    +  'value',
    +  'optional',
    +  'remember',
    +  'widget',
    +  'label',
    +  'description',
    +  'add_group',
    +  'more',
    +  'group_items',
    +  'default_group',
    +  'default_group_multiple'
    +  )
    +}}
    +
    +{{ table }}
    

    Just curious, what renders the actual thing then? (not all of those are printed out earlier)

  2. +++ b/core/modules/views_ui/views_ui.theme.inc
    @@ -160,15 +144,57 @@ function theme_views_ui_build_group_filter_form($variables) {
    +      '#attributes' => array(
    +        'id' => 'views-remove-link-' . $group_id,
    +        'class' => array(
    +          'views-hidden',
    +          'views-button-remove',
    +          'views-groups-remove-link',
    +          'views-remove-link',
    +        ),
    +        'alt' => t('Remove this item'),
    

    Someone really has to write proper tests and use data instead.

Status: Needs review » Needs work

The last submitted patch, 23: convert-1963978-23.patch, failed testing.

lauriii’s picture

Issue tags: -Novice
star-szr’s picture

joelpittet’s picture

Issue tags: -Needs reroll
FileSize
62.87 KB

@dawehner thanks for the review, we are having an issue right now trying to see this template.

We think it may be here:

But we can't open that link. Maybe it's broken? Is there another way to get at this form through the UI?

RE:
#24.1 The only 3 that are excluded there are in the table. I could be very wrong there as that table build up is a bit strange using #rows where as #type=>table usually doesn't specify #rows those are the child elements.

#24.2 I agree it should be using data attributes, this is however just a conversion issue we can create a follow-up to address that.

joelpittet’s picture

joelpittet’s picture

Status: Needs work » Needs review
Issue tags: -@todo clean-up
FileSize
6.8 KB

Rerolled. And left the remove link structure more or less alone.

The add group button still doesn't work before or after this patch, but everything else seems to with manual testing.

Also instead of using |without on the items that are built up in the table and not printed in the template explictely I hide() on them the preprocess so they are easy to spot.

Maybe we can just put this in without that group filter things fixed? The related fix for that doesn't seem to be touching any template logic.

joelpittet’s picture

Issue tags: +@todo clean-up, +Novice

Whoops @todo cleanup is still a thing, gotta figure out what those things are...

Status: Needs review » Needs work

The last submitted patch, 30: convert-1963978-30.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 30: convert-1963978-30.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
FileSize
6.56 KB

This ones just needs to get green again, the bugs in the JS look to be resolved in the RTBC #2168893: Views filters groups adding and removing is broken

Status: Needs review » Needs work

The last submitted patch, 35: convert-1963978-35.patch, failed testing.

joelpittet’s picture

Issue tags: +Needs reroll

Whoops, poor re-roll from #30 I don't trust myself at this hour.

dimaro’s picture

Status: Needs work » Needs review
FileSize
996 bytes
6.58 KB

I start by trying to fix the syntax error.

Hope it works!
Although I think possibly errors in the test.

Status: Needs review » Needs work

The last submitted patch, 38: convert-1963978-38.patch, failed testing.

joelpittet’s picture

Issue tags: -Needs reroll

@dimaro thanks for getting it to not have that syntax error, I managed to make another one here I believe from the test results:

+++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
@@ -0,0 +1,69 @@
+    'more',
+  )

This is like PHP where it doesn't like that ending comma in a function/filter.

@dimaro, Do you want to see how many fails/exceptions this fixes? If you have any idea what those twig variables with @todo actually are could you attempt filling out the ones you know? That would be a huge help! Views in D7 is lacking for their documentation mostly because it's admin facing.

NickDickinsonWilde’s picture

Status: Needs work » Needs review
FileSize
8.38 KB

Seeing as I was mucking around with the views filters, I wanted this completed so that I could properly theme it in my theme.

So basically finished this up.

Status: Needs review » Needs work

The last submitted patch, 41: convert-1963978-41.patch, failed testing.

NickDickinsonWilde’s picture

Status: Needs work » Needs review
FileSize
8.85 KB

forgot to include the one file in my patch.

joelpittet’s picture

Status: Needs review » Needs work
Issue tags: -@todo clean-up

@NickWilde thank you very much for tackling one of few theme functions left. Just a couple of questions and nitpiks:

Also thanks for finishing all those @todos, I really didn't know what half of them were:)

  1. +++ b/core/modules/views_ui/js/views-admin.js
    @@ -836,14 +836,14 @@
    -          $('input.default-radios').hide();
    +          $('input.default-radios').parent().hide();
    ...
    -          $('input.default-checkboxes').show();
    +          $('input.default-checkboxes').parent().show();
    ...
    -          $('input.default-checkboxes').hide();
    +          $('input.default-checkboxes').parent().hide()
    ...
    -          $('input.default-radios').show();
    +          $('input.default-radios').parent().show();
    

    This looks a bit out of scope can you explain this change?

  2. +++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
    @@ -0,0 +1,69 @@
    + *   - multiple:  A checkbox to allow multiple filter values.
    

    Nit: Extra space before the A

  3. +++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
    @@ -0,0 +1,69 @@
    +{# Render the rest of the form elements excluding elements that are printed elsewhere. #}
    

    Should wrap this on two lines for the 80 character coding standard for comments.

  4. +++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
    @@ -0,0 +1,69 @@
    +{{ form.more }}
    \ No newline at end of file
    

    Need a new line at end.

  5. +++ b/core/modules/views_ui/views_ui.theme.inc
    @@ -91,35 +91,23 @@ function template_preprocess_views_ui_view_info(&$variables) {
    +  $form_state = new FormState();
    +  $form['default_group'] = Element\Radios::processRadios($form['default_group'], $form_state, $form);
    +  $form['default_group_multiple'] = Element\Checkboxes::processCheckboxes($form['default_group_multiple'], $form_state, $form);
    +  $form['default_group']['All']['#title'] = '';
    
    @@ -128,13 +116,6 @@ function theme_views_ui_build_group_filter_form($variables) {
    -  $form_state = new FormState();
    -  $form['default_group'] = Element\Radios::processRadios($form['default_group'], $form_state, $form);
    -  $form['default_group_multiple'] = Element\Checkboxes::processCheckboxes($form['default_group_multiple'], $form_state, $form);
    -  $form['default_group']['All']['#title'] = '';
    

    Does this hunk need to change location?

  6. +++ b/core/modules/views_ui/views_ui.theme.inc
    @@ -148,24 +129,26 @@ function theme_views_ui_build_group_filter_form($variables) {
    +      'default' => [
    +        'data' => [
    

    We don't need to do the array syntax changes that affect this patch size. We try to make that change on only parts of the patch that are changing so that it's easy to review the patch without doing the mental gymnastics around what is a syntax change and what is critical change part of the patch. (loose rule)

Great work and green patches are always nice to see!

rishikant05’s picture

Assigned: Unassigned » rishikant05
NickDickinsonWilde’s picture

Status: Needs work » Needs review
FileSize
8.54 KB

@joelpittet

Well I like to have good documentation. At least when I'm editing code... writing new code I tend to document on the slim side of what I will like if I edit the area later. Nit picks are always appreciated :)

1. That really really is in needed - might be out of scope slightly but if so it should be done as a seperate patch. That change hides the div with the label and the checkbox or radio button for the default selection - without that change it was displaying two labels and either the checkbox or the radio button (in the table of options)

2. fixed

3. fixed - it was from the old patch and didn't notice the length of it.

4. fixed

5. Not really. Fixed

6. that's from inherited from the older versions, should I change that out?

Thanks;
Nick

rishikant05’s picture

Assigned: rishikant05 » Unassigned
joelpittet’s picture

Status: Needs review » Needs work

@NickWilde thanks for the quick fix.

Re #46.5 probably my bad :P, but yes please do. You can keep the short syntax in hunks that have changed but otherwise please revert, the committers will thank you and the reviewers too:)

#46.1 Hmm, I wonder if that is being taken care of already in #2168893: Views filters groups adding and removing is broken? Or at least that sounds like the last comments were referring to? Regardless, let's take that out so it doesn't block this patch from going into core. Maybe create a follow-up issue for that and let us all know about it so we can test and push that fix in on the JS.

Couple more things, the fixes look great thanks again!

  1. +++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
    @@ -0,0 +1,72 @@
    + *   - remember: A checkbox to remember selected filter value (per user).
    

    "... selected filter values ..." or "... the selected filter value ..."? Needs plural or an article qualifier.

  2. +++ b/core/modules/views_ui/views_ui.theme.inc
    @@ -91,35 +91,18 @@ function template_preprocess_views_ui_view_info(&$variables) {
    +  /* Prepare table of options */
    
    @@ -129,12 +112,12 @@ function theme_views_ui_build_group_filter_form($variables) {
    +  /*prepare default selectors*/
    

    Both of these should be inline comments. //
    And have space before the comment, uppercase the first character in the sentence and period at the end as per our coding standards.

NickDickinsonWilde’s picture

Status: Needs work » Needs review
FileSize
7.29 KB

#46.1 reverted that on the lines that was the only change
#46.2 removed and I'll look into doing it as a separate patch

#48.1 fixed (also removed another variable description as it doesn't actually exist in this form).
#48.2 fixed

Thanks;
Nick

Status: Needs review » Needs work

The last submitted patch, 49: convert-1963978-49.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 49: convert-1963978-49.patch, failed testing.

NickDickinsonWilde’s picture

Status: Needs work » Needs review

I just regenerated the patch and got the same content. Do you think that is a testbot failure? or something I need to deal with? With those changes it is running fine in usage.
Thanks
Nick

Cottser queued 49: convert-1963978-49.patch for re-testing.

star-szr’s picture

@NickWilde great stuff! Sometimes looking at the detailed testbot results will show a PHP fatal error, or that some tests are failing or throwing exceptions. But I didn't see any of that, so giving it another spin.

star-szr’s picture

A couple minor points, but it's green now :)

  1. +++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
    @@ -0,0 +1,71 @@
    +<div class="clearfix">
    +<div class="views-left-40">
    +  {{ form.optional }}
    +  {{ form.remember }}
    +  {{ form.identifier }}
    +</div>
    +<div class="views-right-60">
    +  {{ form.widget }}
    +  {{ form.label }}
    +  {{ form.description }}
    +</div>
    +</div>
    

    I'd say indent everything inside the div.clearfix here.

  2. +++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
    @@ -0,0 +1,71 @@
    +{{ form|without(
    +    'form_description',
    +    'expose_button',
    +    'group_button',
    +    'required',
    +    'operator',
    +    'value',
    +    'optional',
    +    'remember',
    +    'widget',
    +    'label',
    +    'description',
    +    'add_group',
    +    'more',
    +    'admin_label',
    +    'identifier'
    +  )
    +}}
    

    Maybe this should either just be alphabetized or should follow the order in which the other elements are printed.

NickDickinsonWilde’s picture

FileSize
7.26 KB

1. indented.
2. ordered to be the same as they are printed. (and removed a couple of invalid ones while I was examining that part)
Thanks;
Nick

Status: Needs review » Needs work

The last submitted patch, 58: convert-1963978-58.patch, failed testing.

NickDickinsonWilde’s picture

Status: Needs work » Needs review
FileSize
7.26 KB
+++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
@@ -0,0 +1,71 @@
+    'identifier'

oops

Status: Needs review » Needs work

The last submitted patch, 60: convert-1963978-59.patch, failed testing.

joelpittet’s picture

The latest patch says:

patch: **** malformed patch at line 75:

When I try to apply it. Did you maybe try to remove something directly from the patch file instead of creating a new patch?

It says the new html.twig file is @@ -0,0 +1,71 @@ meaning 71 lines, yet there are only 68 lines in the patch from my count.

It's possible to remove lines from a patch file but the numbers there need to change too. IMO it's not worth the hassle, let git do it.

star-szr’s picture

Yup, let git do it, and when you let git do it you can also make interdiffs which are very useful for getting your patch reviewed quicker. And that is usually the biggest thing that we lack is patch reviews! :)

NickDickinsonWilde’s picture

FileSize
7.26 KB

oh good job Nick... I always use git (1/2 dozen commits make up this patch on my end). Except for this once when it was all done except that tiny change and then I go and forget to change the line numbers whooo.
fixed numbers attached.

NickDickinsonWilde’s picture

Status: Needs work » Needs review
joelpittet’s picture

Status: Needs review » Needs work

Thank you again @NickWilde. I'd likely do that manual patch edit and post it too, no worries;) I think we just need someone to do a bit of manual testing now. It's a bit tricky since it's kind of broken. The JS patch in #2168893: Views filters groups adding and removing is broken and that other JS code you had would help the manual testing along.

We just need to confirm the markup is identical before and after this patch. And that it still works.

To that task there is one more thing I spotted:

+++ b/core/modules/views_ui/views_ui.theme.inc
@@ -150,22 +133,24 @@ function theme_views_ui_build_group_filter_form($variables) {
+          $form['group_items'][$group_id]['remove'],
           '#markup' => drupal_render($form['group_items'][$group_id]['remove']) . \Drupal::l(SafeMarkup::format('<span>@text</span>', array('@text' => t('Remove'))), Url::fromRoute('<none>', [], array('attributes' => array('id' => 'views-remove-link-' . $group_id, 'class' => array('views-hidden', 'views-button-remove', 'views-groups-remove-link', 'views-remove-link'), 'alt' => t('Remove this item'), 'title' => t('Remove this item'))))),

This looks as it would cause a dup, since we aren't converting the drupal_render in this hunk. I think the critical is dealing with this so we can remove this added line.

NickDickinsonWilde’s picture

hmm that is a line I didn't add so I'm not actually sure on it. I'll do some manual testing and checks into removing it and functionality testing too.
(was away yesterday)

NickDickinsonWilde’s picture

Status: Needs work » Needs review
FileSize
7.21 KB
147.19 KB

alrighty did some testing.

We just need to confirm the markup is identical before and after this patch. And that it still works.

Markup is *not* identical. I intentionally made some changes. See screenshot for the example of messed up spot that is fixed with this partch. All functionality works as well or slightly better than before - still need some javascript work but that is seperate from this.

Status: Needs review » Needs work

The last submitted patch, 68: convert-1963978-68.patch, failed testing.

NickDickinsonWilde’s picture

Status: Needs work » Needs review
FileSize
7.21 KB

of course it would be good if I uploaded the right patch.

NickDickinsonWilde’s picture

I have now uploaded that JavaScript improvement that was in an earlier version of the patch to a new issue

joelpittet’s picture

joelpittet’s picture

FileSize
5.8 KB

Re-rolled.

joelpittet’s picture

FileSize
5.75 KB
1.03 KB

Removed clearfix, no longer in head.

joelpittet’s picture

FileSize
2.04 KB
5.44 KB

Removed a bunch of things from the template that weren't in the theme function anymore.

joelpittet’s picture

FileSize
6.43 KB
1.98 KB

Remove the last drupal_render() early render call from there and make the unset()'s more specific so they don't accidentally remove something they shouldn't from the form.

joelpittet’s picture

FileSize
1.32 KB
7.19 KB

Missed a few more drupal_render() calls. That should be the last of them.

joelpittet’s picture

I've done a manual test and it looks like currently without the patch that form is quite broken. Also some of the screenshots I took above are totally the wrong form (those were for reorganizing the filters, while this is for grouping exposed filters)

Attached is whitespace normalized before and after with twig debug turned on so I know it's the right template this time.

Before:

After:

Maybe someone can confirm my findings here and RTBC?

It looks like the radios are just printed twice before this patch fixes that.

The last submitted patch, 76: convert-1963978-76.patch, failed testing.

The last submitted patch, 75: convert-1963978-75.patch, failed testing.

The last submitted patch, 74: convert-1963978-74.patch, failed testing.

star-szr’s picture

Issue tags: -Novice

Sorry for the noise, testbot is backed up for some reason so I cancelled some of the in between patches.

jmolivas’s picture

Assigned: Unassigned » jmolivas

I am testing this and do a little code cleanup.

jmolivas’s picture

@joelpittet Look good to me, radios are printed once.

filter-criterion

I am uploading a patch including:
- Remove unused use statements at views_ui.module
- Switch to the short array syntax.

Status: Needs review » Needs work

The last submitted patch, 84: convert-1963978-84.patch, failed testing.

jmolivas queued 84: convert-1963978-84.patch for re-testing.

The last submitted patch, 84: convert-1963978-84.patch, failed testing.

tim.plunkett’s picture

This patch went from 7K to 32K somehow...

+++ b/core/modules/views_ui/views_ui.module
@@ -24,15 +20,15 @@ function views_ui_help($route_name, RouteMatchInterface $route_match) {
-      $output .= '<p>' . t('The Views UI module provides an interface for managing views for the <a href="@views">Views module</a>. For more information, see the <a href="@handbook">online documentation for the Views UI module</a>.', array('@views' => \Drupal::url('help.page', array('name' => 'views')), '@handbook' => 'https://www.drupal.org/documentation/modules/views_ui')) . '</p>';
+      $output .= '<p>' . t('The Views UI module provides an interface for managing views for the <a href="@views">Views module</a>. For more information, see the <a href="@handbook">online documentation for the Views UI module</a>.', ['@views' => \Drupal::url('help.page', ['name' => 'views']), '@handbook' => 'https://www.drupal.org/documentation/modules/views_ui']) . '</p>';

Changing lines like this is out of scope, please revert.

joelpittet’s picture

Status: Needs work » Needs review
FileSize
7.19 KB

Thanks for the manual testing @jmolivas.

Yeah we don't go out of our way to make changes unrelated to the task or it's a) Hard to review the changes b) Could unintentionally make patches on the same file need to re-roll. I like short syntax as much as anybody but we need to be tactical on that kind of change;)

Re-posting #77. Let me know if there is anything in #84 that made the conversion to Twig better?

jmolivas’s picture

@joelpittet Besides the short syntax at #84 I did also remove these unused use statements:

 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Url;
-use Drupal\views\Views;
 use Drupal\views\ViewExecutable;
-use Drupal\views_ui\ViewUI;
 use Drupal\views\Analyzer;
-use Drupal\Core\Ajax\AjaxResponse;
-use Drupal\Core\Ajax\ReplaceCommand;
 use Drupal\Component\Utility\Xss;
jmolivas’s picture

@joelpittet Also thanks for reposting #77 and remove my mess ;)

joelpittet’s picture

@jmolivas I don't see those use lines in my version of head, maybe your working directory is behind?

This is all I see:

use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Form\FormState;
use Drupal\Core\Render\Element;
use Drupal\Core\Url;

jmolivas’s picture

@joelpittet I was talking about views_ui.module I did the changes since the file was already updated by the patch, but may be this is also out of scope.

joelpittet’s picture

I'd say it may be out of scope because we aren't removing any of those use in the code below, but maybe @tim.plunkett has an opinion on the matter?

*Putting my hands up to look like a scale* Those removals end up in really small patch issues "Remove unused use statements in blah file". Which is also not fun for committers...

jmolivas’s picture

Assigned: jmolivas » Unassigned
jmolivas’s picture

@joelpittet: Maybe not fun but needed to get fixed but if not good for a new issue, but also not good when file is already updated with a patch when this can happen.

joelpittet’s picture

@jmolivas maybe just add it here and we'll see if it gets kickback;)

jmolivas’s picture

I will and wait

jmolivas’s picture

joelpittet: Removing unused use statements at views_ui.module and just waiting to see if it gets kickback;)

star-szr’s picture

Status: Needs review » Needs work

Only found a couple minor docs things, otherwise this looks great to me.

  1. +++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
    @@ -0,0 +1,57 @@
    + * Default theme implementation for build group filter form.
    

    This should probably say "Views UI" somewhere, maybe.

  2. +++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
    @@ -0,0 +1,57 @@
    + * - form: A render element representing the form.
    

    Since this is a list it needs to end in a colon, we usually do something like end it in ", including:" or ", containing:" or similar. This is for api.d.o parsing I think. See https://www.drupal.org/node/1354#lists.

jmolivas’s picture

cottser: I updated the docs trying to follow your recommendation at #100

damiankloip’s picture

Status: Needs work » Needs review

Maybe not fun but needed to get fixed

Not really. No one will get hurt if it didn't. Very minor stuff :) That tangent wasted a couple of days...

On the plus side, the manual testing really is appreciated.

joelpittet’s picture

@damiankloip Rather a couple of days discussing the issue and learning about core contribution stuff than months++ sitting stagnant. It helps a crap ton just to have eyeballs!

joelpittet’s picture

For my motivation too!

jmolivas’s picture

Uploading fixes to the doc suggested by @cottser since seems like files were deleted on #102

damiankloip’s picture

@joelpittet agree. Eyeballs are king in these here issue queues!

star-szr’s picture

Status: Needs review » Needs work

Thanks!

+++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
@@ -0,0 +1,57 @@
+ * - form: A render element representing the form containing:

This is a bit awkward now, and looking at this again I'm not sure adding a comma before 'containing' will fix it. What about "A render element representing the form. Contains the following:"

+++ b/core/modules/views_ui/templates/views-ui-build-group-filter-form.html.twig
@@ -0,0 +1,57 @@
+ * Default Views UI theme implementation for build group filter form.

These usually start with "Default theme implementation", so I'd put Views UI before "build group filter form" instead :)

Otherwise RTBC from me.

NickDickinsonWilde’s picture

Same as patch in #105 but with @Cottser's doc improvements from #107 applied. (ie no other changes and I'm not making an interdiff for those two lines of documentation)

Status: Needs review » Needs work

The last submitted patch, 108: convert-1963978-108.patch, failed testing.

Status: Needs work » Needs review

star-szr’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks @NickWilde!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 108: convert-1963978-108.patch, failed testing.

Status: Needs work » Needs review
lauriii’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Nice twigifying. It's really nice to be getting rid of all the calls to drupal_render(). Committed 08baa72 and pushed to 8.0.x. Thanks!

  • alexpott committed 08baa72 on 8.0.x
    Issue #1963978 by joelpittet, NickWilde, jmolivas, dimaro, lauriii,...

Status: Fixed » Closed (fixed)

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