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 #1987400 by shanethehat, TrevorBradley | Cottser: Forum.module - Convert theme_ functions to Twig.
Task
Convert theme_ functions to Twig templates.
Remaining
- theme_ function -> Twig conversions (and preprocess function additions or changes) moved over from the existing conversion issue
- Patch review
- Profiling
Theme function name | Conversion status |
---|---|
theme_forum_form | converted |
Related Issues
#1898418: forum.module - Convert PHPTemplate templates to Twig
#1757550: [Meta] Convert core theme functions to Twig templates
#1987510: [meta] Convert all core *.tpl.php templates to Twig as singular patch
Comment | File | Size | Author |
---|---|---|---|
#48 | Source_of__http___d8_dev_admin_structure_forum_add_forum.png | 103.41 KB | joelpittet |
#47 | Выделение_014.png | 31.23 KB | andypost |
#47 | Выделение_013.png | 29.89 KB | andypost |
#47 | 1987400-forum-form-twig-47.patch | 1.62 KB | andypost |
#45 | interdiff.txt | 862 bytes | andypost |
Comments
Comment #0.0
star-szrUpdated issue summary.
Comment #1
c4rl CreditAttribution: c4rl commentedPer #1757550-44: [Meta] Convert core theme functions to Twig templates, retitling to indicate this issue applies to theme_ functions rather than templates. See #1898418: forum.module - Convert PHPTemplate templates to Twig for template conversion.
Comment #1.0
c4rl CreditAttribution: c4rl commentedUpdated issue summary.
Comment #2
shanethehat CreditAttribution: shanethehat commentedComment #3
Hanpersand CreditAttribution: Hanpersand commented#2: twig-forum-theme-only-1987400-2.patch queued for re-testing.
Comment #4
OpenChimp CreditAttribution: OpenChimp commentedprofiling this now
Comment #5
OpenChimp CreditAttribution: OpenChimp commented=== 8.x..8.x compared (519fe63632755..519feb8ccb3f5):
ct : 40,580|40,580|0|0.0%
wt : 377,694|376,751|-943|-0.2%
cpu : 335,787|335,069|-718|-0.2%
mu : 50,206,616|50,206,616|0|0.0%
pmu : 50,271,728|50,271,728|0|0.0%
Profiler output
=== 8.x..1987400 compared (519fe63632755..519febd624b4e):
ct : 40,580|40,580|0|0.0%
wt : 377,694|377,921|227|0.1%
cpu : 335,787|336,040|253|0.1%
mu : 50,206,616|50,206,712|96|0.0%
pmu : 50,271,728|50,272,256|528|0.0%
Profiler output
---
ct = function calls, wt = wall time, cpu = cpu time used, mu = memory usage, pmu = peak memory usage
The registry has been rebuilt. [success]
'all' cache was cleared in self
Comment #6
OpenChimp CreditAttribution: OpenChimp commentedremoving Profiling tag
Comment #7
OpenChimp CreditAttribution: OpenChimp commentedprofiling not run correctly. Needs to be redone
Comment #8
TrevorBradley CreditAttribution: TrevorBradley commentedI'll profile this.
Comment #9
TrevorBradley CreditAttribution: TrevorBradley commentedStark theme. After a bit of digging, determined that admin/structure/forum/add/forum needed to be my home page. Allowed Anonymous to modify forums. Tweaked bbranches to restart apache after each test to clear APC cache.
Forgive my flakey little laptop, it's 8.x vs 8.x numbers have been consistently non-zero.
=== 8.x..8.x compared (51a27ce83196d..51a27d3f1f1ae):
ct : 38,632|38,632|0|0.0%
wt : 163,432|166,046|2,614|1.6%
cpu : 160,000|164,000|4,000|2.5%
mu : 11,223,208|11,223,208|0|0.0%
pmu : 11,337,400|11,337,400|0|0.0%
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=51a27ce83196d&...
=== 8.x..twig-forum-theme-only-1987400-2 compared (51a27ce83196d..51a27d81b1262):
ct : 38,632|38,720|88|0.2%
wt : 163,432|160,821|-2,611|-1.6%
cpu : 160,000|156,000|-4,000|-2.5%
mu : 11,223,208|11,275,312|52,104|0.5%
pmu : 11,337,400|11,389,952|52,552|0.5%
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=51a27ce83196d&...
Comment #9.0
TrevorBradley CreditAttribution: TrevorBradley commentedList of functions
Comment #10
star-szrWe can also remove the preprocess function here now that #1920886: drupal_render() should check if it's rendering a 'render element' and if so call drupal_render_children() (inline) instead is resolved, and that would be worth re-profiling. Thanks for all the profiling so far!
Comment #11
drupalninja99 CreditAttribution: drupalninja99 commentedRemove which preprocess function?
Comment #12
star-szr@drupalninja99 - template_preprocess_forum_form(). It only contains a workaround for the issue that #1920886: drupal_render() should check if it's rendering a 'render element' and if so call drupal_render_children() (inline) instead solved.
Great work lately BTW :) hope to see you in #drupal-twig sometime.
Comment #13
drupalninja99 CreditAttribution: drupalninja99 commentedThanks! Okay here is the re-rolled patch without "template_preprocess_forum_form" and I also removed a doc reference to template_preprocess_forum_form() in one of the twig files.
Comment #14
star-szrGreat, thanks @drupalninja99! Tagging this for manual testing.
Comment #15
joelpittet#13: twig-forum-theme-only-1987400-13.patch queued for re-testing.
Comment #16
thedavidmeister CreditAttribution: thedavidmeister commentedmanual testing is a novice task
Comment #17
star-szrNeeds a reroll before it can be tested or profiled.
Comment #18
joelpittetre-rolled and removed @see template_preprocess() from the twig template.
Comment #19
star-szrLatest patch doesn't remove theme_forum_form(), will be looking at this and hopefully manual testing during a sprint tomorrow.
Comment #20
star-szrScratch my last comment, not enough sprinters showed up… anyone can work on updating the patch and manual testing.
Comment #21
joelpittetRemoved
theme_forum_form
Comment #22
CaptainWonky CreditAttribution: CaptainWonky commentedrerolled
Comment #23
joelpittetThanks @CaptainWonky
Manual testing looks good.
Btw that ^^ is a diff between 8.x and this branch. The only diff being the form_build_id and a newline character extra at the EOF.
Comment #23.0
joelpittetUpdated issue summary.
Comment #24
joelpittetGoing to profile this on the plane tomorrow :)
Comment #25
star-szrNothin' like a good plane profiling :D
Comment #26
joelpittetScenario:
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=523bd0c5929e9&...
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=523bd0c5929e9&...
Comment #27
joelpittetHere's a minor re-roll too that I needed to do before profiling.
Comment #29
star-szr#27: 1987400-27-twig-theme-forum.patch queued for re-testing.
Comment #30
jibranPatch looks good it is ready to fly. Minor issue.
Should be @file can be fixed at the time of commit.
Comment #31
joelpittetThanks at @jibran
Comment #32
David Hernández CreditAttribution: David Hernández commented#31: 1987400-31-twig-forum-theme.patch queued for re-testing.
Comment #33
joelpittetPostponing this on #2092343: Consolidate forum.module and remove call to _theme_table_cell() within template_preprocess_forum_topic_list()
Discussed with @markcarver don't want to send another single variable template conversion through to core.
Once that one get's sorted this can be closed as duplicate or won't fix.
Comment #33.0
joelpittetUpdate conversion table
Comment #34
star-szrComment #35
joelpittet31: 1987400-31-twig-forum-theme.patch queued for re-testing.
Comment #37
joelpittetRe-roll. Maybe consider just removing this?
Comment #38
star-szrIMO this should just be a theme_form/form.html.twig suggestion if possible.
form__forum maybe.
Comment #39
joelpittetI tried that and it failed on both attempts locally.
and
Maybe you want to take a stab at this @Cottser?
Comment #40
star-szrLet's go needs work for now.
Comment #41
jerdavisRe-rolling based on #39. This seems to be working locally, let's see what test bot has to say
Comment #43
joelpittet@jerdavis just noticed that this is missing the twig template. Would you mind adding in?
@Cottser, I think we should push this one in and we can still work on that other issue for consolidation of these.
#2265991: Replace theme_*_form() with theme suggestion for #theme => form.
Comment #44
andypostI think no reason to consolidate removals by allowing module maintainers to review the changes.
Suppose better to re-title this to "remove theme_forum_form()"
should be array
Comment #45
andypostinterdiff
Comment #46
joelpittet@andypost this seems like a good solution... just can't seem to test it out. I'd assume you could just go to admin/structure/forum/add/forum after installing the forum module and see the form. or admin/structure/taxonomy/manage/forums/add
But none of them produce this form from what I can see. I wanted to just see if the seven or bartik template override of form.html.twig as form--forum.html.twig would pick up. Any idea?
Comment #47
andypostreroll
this form used in
forum.add_forum
route/admin/structure/forum/add/forum
no difference
before
after
Comment #48
joelpittetThanks for the re-roll @andypost and for confirming the path for me. I was looking for the string "Short but meaningful name for this collection of threaded discussions." But that didn't show up, but either something else is broken or it's getting overwritten someplace else, nevertheless out of the scope of this.
I gave this a test and it works like a charm:
Just a note, the before and after screenshots you posted don't give much detail though they are appreciated, showing that nothing has changed can yield false positives.
Comment #49
alexpottCommitted 5a07eb9 and pushed to 8.x. Thanks!