Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Issue #2152227 by JeroenT, joelpittet, steinmb, steveoliver, hussainweb, shanethehat, jenlampton, kpa, AnythonyR, EVIIILJ, kgoel, Cottser, dsdeiz, hanpersand: Convert theme_tableselect() to #theme table__tableselect
Task
Convert theme_tableselect() to #theme table__tableselect.
Remaining tasks
PatchPatch reviewManual testing- Profiling
Steps to test
- Add an article and add a number of comments and visit.
- Visit /admin/content/comment
Comment | File | Size | Author |
---|---|---|---|
#34 | 2152227-tableselect-34.patch | 4.33 KB | joelpittet |
#32 | Kaleidoscope_–_tableselect-before-empty_txt___tableselect-after-empty_txt.png | 35.41 KB | joelpittet |
#25 | interdiff.txt | 2.8 KB | star-szr |
#25 | 2152227-25.patch | 4.28 KB | star-szr |
#23 | interdiff.txt | 2.24 KB | JeroenT |
Comments
Comment #1
star-szrAdding a commit message to the issue summary so the folks who already worked on #1898480: [meta] form.inc - Convert theme_ functions to Twig and in the Twig sandbox get credit.
Comment #2
JeroenTConverted the theme_tableselect to table__tableselect.
Patch attached
Comment #3
joelpittetAwesome @JeroenT could you add a couple URLs to review this change to the issue summary's Steps to test? Maybe a couple paths that use table select?
I'll do a manual review for you;)
Comment #4
joelpittetAdded steps to the Issue Summary. Did a quick test and The responsive JS and table class were missing from the comments admin table select.
May need
'#responsive' => TRUE, and possibly some other type=>table default properties.
Comment #5
JeroenT@JoelPittet,
Thank you for the review. I added the responsive + added some missing classes to the table.
Comment #6
steinmb CreditAttribution: steinmb commentedPSR-4 fix
Comment #7
joelpittetThis looks good, just tried it out again and reviewed. I'm just posting those changes in this patch. Let me know if you have any concerns with the changes?
No other pre_renders type hint the $element so I'd rather not in this case unless you want to open an issue to do them all at once?
You don't need to call drupal_render here. Just data => $username.
Save the flattening.
Comment #8
joelpittetthanks @steinmb and @JeroenT
Here's a manual testing. It's looking good, this patch fixes a responsive bug in rendering the comments form. See screenshots.
Comment #9
JeroenT@joelpittet,
The responsive fixes come from RESPONSIVE_PRIORITY_MEDIUM and RESPONSIVE_PRIORITY_LOW:
Comment #10
joelpittetThanks, yeah this is ready RTBC in my opinion, just checking if Cottser agrees to remove the profiling task as it's usually just a Admin UI item and we aren't using it in many places nor are we converting to twig.
Comment #11
star-szrThis should be faster because it wouldn't be going through the whole theme stack. I can profile it if we want to double check.
@param should be $element here.
Other than that looks good at a glance.
Comment #12
JeroenTI made changes to the comment of the function form_pre_render_tableselect.
Patch attached.
Comment #13
JeroenTWrong interdiff, this is the right one.
Comment #14
star-szrThanks @JeroenT!
Cool, now everything nested underneath @param needs to be outdented by 2 spaces though :)
Comment #15
JeroenTI outdented everything underneath @param.
Patch attached.
Comment #16
star-szrThanks! I missed that in the previous patch the @param didn't have a data type specified, we should add that since we're changing that line: https://drupal.org/node/1354#param
Also the @code section needs to be indented by 2 spaces so that it stays on the same level as the @param info.
Comment #17
star-szrUpdating suggested commit message.
Comment #18
JeroenT@Cottser, I hope this is the last update to the comments ;)
I also changed the comment of form_process_tableselect.
Patch attached.
Comment #20
JeroenT18: 2152227-tableselect-suggestion-17.patch queued for re-testing.
Comment #21
star-szrWe shouldn't touch form_process_tableselect() if we weren't changing that hunk already (and it doesn't look like we were). Scope is a delicate thing :)
Comment #22
star-szrThe indenting on the @code is not right yet, it's the
@code...@endcode
(and its contents) that needed to be indented, not just the contents. Sorry for any miscommunication there.Comment #23
JeroenTOk, I think I get it now.
I also removed the changes to the comment of form_process_tableselect. I thought i could also change this comment because it's also about the tableselect.
Patch attached.
Comment #24
star-szrThanks again @JeroenT!
Looking pretty good here, I'm going to dig in deeper and do some profiling and testing. In the meantime, here are some minor documentation/coding standards items to look at:
This should probably say "see table.html.twig" instead of "see theme_table()" because theme_table() is gone now.
Should this reference point to form_pre_render_tableselect() now instead of just being removed?
Minor: Missing a space after the first array item per https://drupal.org/coding-standards#array
Comment #25
star-szrLooks like this patch may have gotten a bit eager trying to fix this bug: #2296859: [regression] Responsive classes not always added to table rows
With the attached patch (which also takes care of #24) those changes are rolled back and the markup is identical except for two changes:
Also poking around it looks like #type table supports tableselect and it looks like the plan was to remove this anyway, so ultimately this might be going away but it's still a decent cleanup from my perspective. See #1876714: Remove #type 'tableselect'
Comment #28
star-szrLooks like a slight performance hit but nothing too crazy. I profiled admin/content/comment with 50 comments, render cache disabled.
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=53ccf06f3ae60&...
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=53ccf06f3ae60&...
Comment #31
JeroenTMarking as needs review.
Comment #32
joelpittetDid a manual test, and it works great. Only diff was it now has an ID and before it didn't. This is due to the addtion of drupal_pre_render_table I believe.
Comment #34
joelpittetRe-rolled, something must have just changed slightly as I just reviewed it.
Comment #35
alexpottCommitted 28ef6b2 and pushed to 8.0.x. Thanks!
Comment #37
alexpottOops - we need a change record for this. If this isn't done in a couple of days I'll have to make this a beta blocker :(
Comment #38
penyaskitoWanted to do this change record, and looked at the parent for possibly existing ones or using one as a template. Found that #2152205: Convert theme_date() to #theme input__date didn't have one. Maybe also needs one?
Comment #39
joelpittetDrafted a change record, not sure it's really nessasary but maybe it's helpful?
In D7 we still had the #type=>tableselect, this just gets rid of the extra theme function and replaces it with a table template suggestion.
https://www.drupal.org/node/2322315
Comment #40
alexpottActually all I think we need to do is add this issue to this CR https://www.drupal.org/node/1876710 since what we people need to know to do is this:
Sorry for the distraction.
Comment #41
alexpottI think https://www.drupal.org/node/2322315 does not contain the necessary detail if someone was actually using theme_tableselect().
Comment #42
star-szrUltimately I'd like to think table__tableselect will be going away as well in favour of what @alexpott showed in #40 which is using #type table plus #tableselect = TRUE everywhere:
#1876714: Remove #type 'tableselect'
This is a step in the right direction either way though.