Issue #1898070 by artofeclipse, vlad.dancer, steveoliver, EVIIILJ, joelpittet, elv, c4rl, jenlampton, duellj, Cottser, OpenChimp: Convert file module to Twig.
Task
Use Twig instead of PHPTemplate
Remaining
- Manual testing
| Theme function name/template path | Conversion status | Needs Markup Comparison | Needs Profiling |
|---|---|---|---|
| theme_file_formatter_table | converted | n/a | |
| theme_file_icon | removed! now uses #theme => 'image__file_icon' | n/a | |
| theme_file_link | converted | #161 | |
| theme_file_managed_file | converted | #161 | |
| theme_file_upload_help | converted | #161 | |
| theme_file_widget | converted | #161 | |
| theme_file_widget_multiple | converted, see also #type table conversion issue: #1938902: Convert file theme tables to table #type | #161 |
To test this code...
1) Add a file field to a content type
2) Create a piece of content, and check that the upload form element is using the file-widget.html.twig
3) attach a file and save
4a) view the node to see if the icon was rendered using file-icon.html.twig (no longer applicable)
4b) view the node to see if the link to the file was rendered using file-link.html.twig
5) edit the node to see if the upload help is rendered using file-upload-help.html.twig
6) edit your content type and make your file field multi-value.
7) edit your node again and confirm that the widget is rendered using file-widget-multiple.html.twig
8) enable the file_module_test module to test managed files.
9) Go to /file/test to confirm that the upload field is rendered using file-managed-file.html.twig
Related Issues
#1757550: [Meta] Convert core theme functions to Twig templates
#1938902: Convert file theme tables to table #type
| Comment | File | Size | Author |
|---|---|---|---|
| #178 | 1898070-twig-theme-file-178.patch | 15.11 KB | joelpittet |
| #176 | interdiff.txt | 2.36 KB | joelpittet |
| #174 | 1898070-twig-theme-file-174.patch | 15.09 KB | joelpittet |
| #172 | 1898070-twig-theme-file-172.patch | 15.09 KB | joelpittet |
| #168 | Upload_text_file_rename.png | 21.84 KB | steinmb |
Comments
Comment #1
c4rl commentedTagging
Comment #2
duellj commentedWorking on this
Comment #3
duellj commentedAttached patch pulls over twig files for the file module from the twig sandbox. Once/if #1898070: file.module - Convert theme_ functions to Twig lands, theme('file_managed_field') and theme('file_formatter_table') can probably be pulled out.
Also, what's the recommended way for commenting preprocess functions for twig. In file.module in the twig sandbox there are several different methods:
How verbose do we need to be?
Comment #4
star-szrThanks for this, @duellj!
This is #1898070: file.module - Convert theme_ functions to Twig, though :)
We're working out the preprocess doc standards in #1913208: [policy] Standardize template preprocess function documentation.
Comment #5
duellj commentedThanks Cottser, thought I'd ask, since the function headers are different in this patch. Good to know that preprocess headers are getting figured out, they seem pretty inconsistent.
Comment #6
duellj commentedOh, whoops :). Now I see what you're saying. Meant to link to #1876712: [meta] Convert all tables in core to new #type 'table' in comment #3.
Comment #7
star-szrStarted work on reviewing this, just nitpicky documentation tweaks so far so I'll roll a new patch and post in the next day or two :)
Comment #8
berdirNote that this will conflict with #1839068: Implement the new entity field API for the file field type
Comment #9
star-szr#8 - Thanks @Berdir, the changes look pretty manageable, we can certainly reroll.
Revised patch to address some minor docs issues as well as convert theme() calls in preprocess to render arrays, thanks to @steveoliver for the help with that.
A couple things I'm not sure about:
* - element_attributes: Remaining HTML attributes for the containing element.Should this say "container element" instead? Found in file-widget.html.twig and file-managed-file.html.twig.
Finally, template_preprocess_file_upload_help() might benefit from a similar treatment as being discussed in #1918856: Put each module's help into a separate Twig file.
Comment #10
star-szrAdded a commit message to the summary as well after looking at git blame and sandbox issues.
Comment #11
duellj commentedThanks Cottser,
I wasn't sure what the process was for pulling in commits from sandboxes. Feel free to move those other functions back to file.admin.inc. I had moved them because it made sense to me that all modules preprocess functions live in one place, but I can see how keeping them in the files where they are used makes more sense.
Comment #12
star-szrThanks @duellj, that's helpful. I'll reroll to split up the preprocess functions again.
BTW @c4rl put together a great screencast on how to pull in the files and changes from the sandbox, I just added a link to it in the meta issue under Resources: #1757550: [Meta] Convert core theme functions to Twig templates.
Comment #13
star-szrOkay, moved things back to file.field.inc and did a bit more documentation cleanup. The interdiff won't be super helpful but I've included it anyway. Better to review the actual patch, since it replaces the theme() functions in place now, resulting in a smaller patch too!
Comment #15
star-szrI figured that might happen, will take a look in the next day or two.
Comment #16
star-szrForgot one important detail:
Comment #17
star-szrLooking at the latest patch with Dreditor I noticed the docblock in a few of the Twig template files was misaligned.
Comment #18
star-szrNeeds a reroll now that #1839068: Implement the new entity field API for the file field type is in.
Comment #18.0
star-szrAdd commit message to issue summary
Comment #19
jenlampton- Rerolled against latest HEAD.
- Changed
icon_urltosrcin file-icon.html.twig and removed the @todo- Removed mention of data types in docblock in file-link.html.twig
- Removed mention of data types in docblock in file-upload-help.html.twig
- Renamed
element_attributestoattributesin file-widget.html.twig- Renamed
childrentoelementin file-widget-multiple.html.twig- Modified file-managed-file.html.twig to be identical to file-widget.html.twig
* Created follow-up issue: #1926610: Consolidate file-managed-file.html.twig and file-widget.html.twig since they are identical
I can't confirm that file-managed-file is even being used. Could whoever tests this patch please confirm, and if so, update the issue summary to include instructions on how that can be tested?
Comment #19.0
jenlamptonAdded how to test
Comment #21
star-szrFound a stray dpm(), removing it fixes the test failures locally. No other changes.
One more thought:
Should we add 'file' to these while we're at it?
Comment #21.0
star-szrmore test
Comment #22
jenlamptonI figured out how to test a managed file (Issue summary updated), and it works! :)
I don't think we need to add a 'file' definition in hook_theme since all these preprocess functions are in file.module, or in file.field.inc, which is included at the top of file.module anyway.
Comment #23
dave reidDoes changing t() to format_string() we lose translations of those help lines? That doesn't really seem desired.
Comment #24
dave reidI don't really see why moving the translation of the upload help moves from the template preprocessing to the template itself. Seems like this means we lose discoverability of those translation strings and it seems like an unnecessary change.
Comment #25
jenlamptonHere's a re-roll without the inadvertent change from t() to format_string(). Agreed, this shouldn't be in here.
Comment #26
jenlamptonAnd here's a version that also removes theme_file_icon
and brings preprocess docs up to new standards
Comment #27
jenlamptonAnd just in case anyone did want to be able to override the file icon :)
Comment #28
star-szrNice work, @jenlampton!
Interdiff between #21 and #27.
Comment #30
star-szr#27: core-update_file_to_twig-1898070-27.patch queued for re-testing.
Comment #32
star-szr#27: core-update_file_to_twig-1898070-27.patch queued for re-testing.
Comment #33
koppie commentedI tested this patch and it works! However, I did spot a few minor issues:
I'm going to leave the status as "needs work" because the doc blocks really should get fleshed out.
Comment #34
star-szrUnassigning, haven't had time to work on this issue recently.
Comment #35
star-szr@koppie - thanks for the review! We'll definitely fix up the documentation.
Regarding point #3 - I don't think we'll consolidate file-managed-file and file-widget just yet, we're focusing on straight conversion for the time being. Good note though :)
Comment #36
star-szrNice - for the consolidation, @jenlampton already opened an issue: #1926610: Consolidate file-managed-file.html.twig and file-widget.html.twig since they are identical
Comment #36.0
star-szradded how to test managed files
Comment #36.1
star-szrAdd #type table conversion issue to related
Comment #36.2
star-szrAdd conversion summary table
Comment #37
star-szrTagging as Novice for the docs tweaks brought up in #33, adding variable documentation to a couple of the preprocess functions.
Comment #38
star-szrAfter looking at this patch again, the docs tweaks in #33 do not need to be done. These variables are added in the preprocess functions so they are not @params.
See file_theme().
Comment #39
star-szr#27: core-update_file_to_twig-1898070-27.patch queued for re-testing.
Comment #40
star-szrTags.
Comment #41
star-szr#27: core-update_file_to_twig-1898070-27.patch queued for re-testing.
Comment #43
star-szrThis patch will need a reroll since it no longer applies.
Rerolling instructions: http://drupal.org/patch/reroll
Comment #43.0
star-szrLinkify #type table issue
Comment #43.1
star-szrRemove sandbox link
Comment #44
bdgreen commentedComment #46
star-szrThanks @bdgreen! Can you please upload those two patches combined together into one .patch file? It also looks like we're missing the added .html.twig template files.
Comment #47
bdgreen commentedComment #48
bdgreen commentedComment #49
star-szr@bdgreen - Thanks! That looks like a reroll of #21, not #27. Can you confirm?
Unless otherwise specified we always reroll the latest patch on the issue. The only reason #27 is red is because I had it re-tested in #41 and it no longer applied. Before that it was green :)
Comment #50
bdgreen commentedI respect your patience ;) Thanks @Cottser. Redone with #27 patch ...
Comment #52
star-szrThanks for your patience too @bdgreen :) I will take a look and see if I can make sense of the test failures.
Comment #53
bdgreen commented@cottser, thanks. Re-rolled again today after full new install of 8.x. But cannot complete a local Testing as for whatever setup after enabling "Testing" module, clicking Configure (i.e. admin/config/development/testing) I'm given then "white screen". Note: for the patch I did uncomment the three twig settings in settings.php and set Stark 8.0-dev as default theme. Patch is again from comment #27.
Should the bullet "2. Find the comment in the issue where the patch applied cleanly ...", from Re-rolling patches page, be updated given your comment "... we always reroll the latest patch ... "- #49, above?
Comment #54
star-szrSending for review, let's see what testbot thinks. Thanks!
I've expanded on and adjusted http://drupal.org/patch/reroll, I think that's a good addition because I've seen it crop up a time or two before. Take a look and let me know if that makes more sense :)
Comment #55
bdgreen commented@Cottser: your addition to http://drupal.org/patch/reroll looks good to me ;) And, the patch has passed - yes!
Comment #56
star-szr@bdgreen - much better! I think the only discrepancy now with the before-reroll patch (I diffed the two patches) is that the lines building '$output' should be removed:
These lines are not needed anymore, since this is reproduced further down in the function.
Comment #57
bdgreen commentedNot sure I understand.
Do you mean ...
Should read ...
?
Comment #58
star-szr@bdgreen - Sorry for any confusion. Compare these two diffs:
Patch from #27:
Patch from #53:
We don't need to build the $output variable any more - we are converting from a theme function (which returns a string of HTML) to a preprocess function (which returns an array of variables). So the $element lines are fine as is, but any lines building $output should be deleted. Specifically, the three lines I highlighted in my previous comment.
If you can provide an interdiff then we can double check the changes :)
Hope that make a bit more sense. BTW I'm using Dreditor to review these patches and grab the patch snippets for this comment :)
(I noticed we lost the Attribute object in the reroll but I think that's a good thing. I see no point in creating an Attribute object and inserting it into a string immediately.)
Comment #59
bdgreen commented@Cottser: made changes as requested, but now "file size" is not now being displayed with attachment ...
Comment #60
bdgreen commentedReturned to: the "( {file size} )" is lost on applying patch #53
Before patch #53
After patch #53
Latest interfdiff.txt (for #59) & patchs #53 and #59 re-submitted.
Comment #61
bdgreen commentedClearing cache ensures display of the file size for patch #59 (and, #53) :$
Comment #62
star-szrAwesome, thanks! :)
Comment #63
c4rl commentedPer #1757550-44: [Meta] Convert core theme functions to Twig templates, retitling to indicate this issue applies to theme_ functions, which are lower in priority than PHPTemplate conversion issues.
Comment #64
hanpersand commented#9: 1898070-9.patch queued for re-testing.
Comment #65
jesse.d commentedTemplate preprocess functions were not running previously. I'm including file.field.inc in the hook_theme definitions to include them.
Comment #66
jesse.d commentedAttaching screenshots of the file upload field showing the difference between patches from 59 and 65.
Comment #67
OpenChimp commentedprofiling this now
Comment #68
OpenChimp commented=== 8.x..8.x compared (519fe63632755..519fe7b00df53):
ct : 40,580|40,580|0|0.0%
wt : 377,694|378,672|978|0.3%
cpu : 335,787|335,713|-74|-0.0%
mu : 50,206,616|50,206,616|0|0.0%
pmu : 50,271,728|50,271,728|0|0.0%
Profiler output
=== 8.x..1898070 compared (519fe63632755..519fe7e9f08c3):
ct : 40,580|40,580|0|0.0%
wt : 377,694|379,540|1,846|0.5%
cpu : 335,787|336,211|424|0.1%
mu : 50,206,616|50,206,496|-120|-0.0%
pmu : 50,271,728|50,272,040|312|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 #69
OpenChimp commentedprofiling not run correctly. Needs to be redone
Comment #71
tlattimore commented#65: core-update_file_to_twig-1898070-65.patch queued for re-testing.
Comment #71.0
tlattimore commentedUpdated issue summary.
Comment #72
joelpittet#65: core-update_file_to_twig-1898070-65.patch queued for re-testing.
Comment #74
star-szrTagging for reroll.
Comment #75
rvilarWorking on the reroll
Comment #76
thedavidmeister commentedRelated #2030243: Remove theme_file_upload_help() from the theme system
Comment #77
star-szrUnassigning since it's been a while, @rvilar you can reassign if you're still working on this.
Comment #78
ssemashka commentedComment #79
ssemashka commentedRerolled.
Comment #81
drupalninja99 commented#79: core-update_file_to_twig-1898070-79.patch queued for re-testing.
Comment #83
les limAt the Drupal Camp Twin Cities code sprint - going to re-reroll #65.
Comment #84
les limRe-rolled #65.
Comment #85
les limI was seeing an issue where a
check_plain()call was getting an object as an argument. Fixed by tweaking #84 to use a File object and its property getters intemplate_preprocess_file_link().Comment #86
les limUnassigning.
Comment #87
xjmAnd again.
Comment #88
star-szrComment #89
ssemashka commentedComment #90
ssemashka commentedComment #91
tlattimore commentedHere is a re-roll of the patch from #85. My Git foo was not good enough to get an interdiff on this one.
Comment #92
tlattimore commentedremoving tag.
Comment #93
star-szrThanks @tlattimore! Interdiffs are not needed for rerolls of patches that don't apply. The only thing I recommend doing is that if you want to make any changes after rerolling, first post the reroll with no changes, then the revised patch with interdiff :)
Retagging for manual testing because it's been a while.
Comment #95
tlattimore commentedEh, I messed up the re-roll on #91 and created a syntax error. Here is a patch with that resolved. See interdiff.
Comment #96
joelpittetHere's a few thing to help cleanup and speed up.
There shouldn't be a need to instantiate the Attribute Class for $variable['attributes'] because it's done for us lazily @see #1982024: Lazy-load Attribute objects later in the rendering process only if needed
I could be wrong but I don't believe drupal_render_children() needs to be called.
ditto
All the @see template_preprocess() can be removed.
Comment #97
tlattimore commentedHere is a patch with the changes that joelpittet requested in #96.
Comment #98
utilum commentedI've been trying to test this and seem to encounter an unrelated issue. After adding a file field to a content type, the upload form element does not appear in the node form. I see this in the current 8.x, in the last commit before the patch, and after applying the patch, both GUI and drush installations. Perhaps I'm repeating an unrelated mistake, but I fail to test.
Comment #99
joelpittet@oshelach I'd suggest maybe talking through your setup on IRC with drupal office hours on the #drupal channel. There is one in 5 hours: http://drupalmentoring.org/ http://countingdownto.com/countdown/186646
I had no problem adding a field and seeing the form element on the latest d8 commit
6cfcb25b7809322e07b594c117bf7e5ad7e9dff4with the patch applied.Comment #100
joelpittetSome code nitpicks:
Not needed for this file.
drupal_render_children shouldn't be needed either.
This doesn't exist.
Don't think this drupal_render needs to be there. We'll try to avoid rendering things before the template for drillablility.
Remove the separated class and let attributes render it if it exists, hopefully avoiding an empty class attribute in markup.
Would like to see this as a join instead of a loop: http://twig.sensiolabs.org/doc/filters/join.html
Comment #101
utilum commentedI'm not sure what "Remove the separated class and let attributes render it if it exists, hopefully avoiding an empty class attribute in markup" means, but I've added that as a todo. Implemented other suggestions.
Comment #102
joelpittetThanks for the patch @oshelach
Here's what I meant there.
<span class="{{ attributes.class }}"{{ attributes }}>{{ icon }} {{ link }}</span>becomes
<span{{ attributes }}>{{ icon }} {{ link }}</span>And that will avoid any empty 'class' attributes from being rendered, therefore generally cleaner markup. The reason for the other way with it separated out is to allow for easier adding of additional css classes in the twig markup but we decided to do that kind of stuff as example in the bartik theme.
I'm pretty sure the removal of drupal_render_children will work, and you may know this already (as I know I always forget) but if you want testbot to test out the patch, just set the status of the issue to 'Needs Review'.
Cheers!
Comment #103
utilum commentedThank you, done.
Mind, this leaves several
drupal_render()calls in file.field.inc and in file.module. Should they not all be removed?Comment #104
thedavidmeister commented#103 - the drupal_render() removal lives somewhere else #2006152: [meta] Don't call theme() directly anywhere outside drupal_render(), this is just Twig.
Comment #105
thedavidmeister commentedwrong, link! sorry #2046881: [meta] Avoid "early rendered" strings where beneficial to do so, build structured data to pass to drupal_render() once instead.
Comment #106
star-szrHowever this patch would be adding these two new ones which seems unnecessary, these should probably be
$variables['element'] = $element;(needs manual testing to confirm).Comment #107
thedavidmeister commentedah, yeah, my bad - don't want to introduce new ones. Is that in the preprocess? I thought we were not doing drupal_render() in preprocess functions any more?
Comment #108
utilum commentedSo, in fact, the remaining
drupal_render()andrender()do need to be removed?Comment #109
thedavidmeister commentedno need to touch anything that's already in the file module, but don't add new render() or drupal_render() calls in the patch.
Keep in mind, the Twig template should internally be rendering anything like {{ foo }} so try what Cottser proposed and manually test it to be sure :)
Comment #110
utilum commentedComment #111
utilum commentedManual test results seem fine to me.
Seems unnecessary as
$elementis not manipulated in the function and manual test seems fine without it.Comment #112
joelpittetre #111I agree, if it's not being modified it doesn't need to be reset back like that, the line can just be removed.
+ $variables['element'] = $element;The only issue we run into sometimes is duplicate rendering of elements sometimes. We just
unset()them as they get repurposed from the main$elementas a workaround. That's just a head-up if you see duplicate elements in the markup.Comment #113
utilum commentedComment #114
star-szrThanks @oshelach, @joelpittet, @thedavidmeister for keeping this one moving :) gave this a review from a code/documentation perspective, notes below.
This line can be removed, this is not defined in file_theme() because the theme hook uses a 'render element'.
We missed one $output/$build line here, needs to be removed.
Needs a period at the end of .html.twig per http://drupal.org/node/1354#drupal (needs to be a complete sentence).
attributes.class should just be 'class', indenting in a list like this means add a dot/drill down.
file-icon.html.twig is no more, this comment needs to be updated.
Why are we trying to put this through the t() filter? The content has already been put through t() in preprocess and we shouldn't be putting variables through t() anyway.
Comment #115
utilum commentedFollows #114, except for item 5 where I understand the need but lost my way between the documentation guidelines and the actual variable prepared by the preprocess funtion, how deep and detailed does this need to be?
Comment #115.0
utilum commentedUpdated issue summary.
Comment #116
star-szrThanks @oshelach, the changes look great!
For the 'icon' variable documentation, what about something simple like this? We just don't want to refer to a non-existent Twig template.
* - icon: An icon representing the file.Comment #117
utilum commentedCool, that's already in the patch.
Comment #118
utilum commentedUm.... removed but not replaced with an explanation of the new variables structure. Coming up.
Comment #119
star-szrCombed through this another time and went through the patch locally, here are some more things that can be fixed up. Thanks for working on this one @oshelach :)
Please revert these changes, they are not needed…
These $file_icon related lines need to be removed, they are creating an unused variable and use '#theme' => 'file_icon' which is being removed.
Let's remove the 'class' line here and use the documentation "HTML attributes for the containing element." as in the other templates here and many that are already in core.
This span needs to be updated to be
<span{{ attributes }}>- no space before the attributes. The Attribute object automatically inserts the space if needed, see https://drupal.org/node/1727592.Comment #120
utilum commentedComment #122
star-szrHum, looks like this needs another reroll! Thanks for working on this @oshelach :)
Comment #123
utilum commentedRerolling, excpet the $icon_directory lines (2nd part of 2nd item in #119), which is used a few lines later in the creation of $variables['icon']. Should it really be eliminated?
Comment #124
star-szrYou're right, $icon_directory is used! Thanks :)
Comment #125
joelpittetCould we remove file-formatter-table and replace it with a suggestion for #theme=>table? The template is only returning a table in {{ content }}
Needs spaces inbetween the {{}} but not before on attributes.
Comment #126
drupalninja99 commentedI can't get the patch to apply. I have tried rolling back to Sept 22 commits with no luck.
Comment #127
drupalninja99 commentedIt seems like the last patch is erroneously trying to add files that already exist like:
Comment #128
star-szrHmm, don't think that's possible:
Maybe you have made some commits on 8.x @drupalninja99?
The patch does need a reroll though, looks like one or two hunks have conflicts.
Comment #129
drupalninja99 commentedIt looks like another ticket has committed changes that are similar to what I am seeing in the last patch. There's seems to be overlap which renders the latest patch irrelevant or at least partially so. I am not sure how to proceed on this.
Comment #130
joelpittetHere's the re-roll from #123
Comment #131
joelpittetAs I mentioned in #125
Replace file-formatter-table.html.twig template with table suggestion and fixed docs and formatting on file-link
Comment #131.0
joelpittetUpdate testing steps
Comment #132
joelpittet131: 1898070-131-twig-theme-file.patch queued for re-testing.
Comment #133
chanderbhushan commentedApplied the patch comment #131, but its not working locally for me.
Comment #134
star-szr@chanderbhushan - can you please provide more information? Did you clear the cache after applying the patch?
Comment #135
chanderbhushan commented131: 1898070-131-twig-theme-file.patch queued for re-testing.
Comment #136
chanderbhushan commented@Cottser I have applied your patch but its not successfully applied.
Comment #137
joelpittet@chanderbhushan What's the error message you get when you try to apply the patch?
git pullgit statusandgit diff origin/8.xcurl https://drupal.org/files/1898070-131-twig-theme-file.patch | git applyshould work.git statusafter to see it has changes.Comment #138
chanderbhushan commented@joelpittet it is working fine now thanks
Comment #139
joelpittet@chanderbhushan great, are you working on manual testing?
Comment #140
chanderbhushan commented@joelpittet Yes, i am doing manual testing.
Comment #141
linl commented131: 1898070-131-twig-theme-file.patch queued for re-testing.
Comment #143
joelpittetSomeone did an improper #type=>table conversion with #rows... argh. That is the prompt for the re-roll.
Comment #144
mikl143: 1898070-143-twig-theme-file.patch queued for re-testing.
It no longer seems to apply, and its conflicts are beyond a simple re-roll.
Comment #146
idflood commentedSimple reroll of patch in #143.
Comment #147
star-szrComment #148
star-szrTagging for reroll. Thanks for the last one @idflood! After reroll we could use some manual testing and profiling on this one :)
Comment #149
linl commentedQuick reroll of #146.
Comment #150
linl commentedOops, an extra space crept in. Here it is again.
Is there a way to cancel the test in #149?
Comment #151
star-szrTagging for reroll.
Comment #152
jjcarrionComment #153
jjcarrionreroll made
Comment #154
m1r1k commentedWorks fine, also tested here #2265127: Add back file theming from 7.x-3.x
Comment #155
alexpottLet's get some evidence of manual testing and it'd be nice to a some profiling too as per #148
Comment #156
joelpittetComment #157
joelpittetTagging for sprints
Comment #158
joelpittetComment #159
benjifisherI am working on profiling.
Comment #160
benjifisherEasy re-roll: files have moved from lib/Drupal/file/Plugin/ to src/Plugin/.
Comment #161
benjifisherI profiled all the elements for this issue. The only one that gets close to a 1% difference is file-widget-multiple.html. Here are the gory details:
Profiling file-widget.html.twig and file-upload-help.html.twig
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=5391fc871e91d&...
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=5391fc871e91d&...
file-link.html.twig
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=539201f8938f4&...
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=539201f8938f4&...
Profiling file-widget-multiple.html.twig
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=539205a48c548&...
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=539205a48c548&...
Profiling file-managed-file.html.twig
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=53920b950c201&...
Run 53920b950c201 uploaded successfully for drupal-perf-drupalcon.
Run 53920c043e98b uploaded successfully for drupal-perf-drupalcon.
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=53920b950c201&...
Comment #162
steinmb commentedTests test
Comment #164
steinmb commentedConfirm that this patch does not fly:
Comment #165
steinmb commentedComment #166
benjifisher@steinmb: Thanks for catching that. It looks like I messed up when creating the patch. Let me try again.
Comment #167
steinmb commentedManual testing. Followed steps found in issue summary.
File uploaded: v1.2.text.txt renamed to v1.2.text_.txt
file-widget.html.twig
file-link.html.twig:
file-upload-help.html.twig
file-widget-multiple.html.twig
This failed:
Running the file_module_test —module.
Comment #168
steinmb commentedProb. not related but. Uploading the file v1.2.text.txt it got renamed to v1.2.text_.txt and the UI created two messages
Comment #169
steinmb commentedI'll take that back, the exception found in #167 was my fault. I'm happy, the issue happy.
Comment #170
joelpittetAwesome work @benjifisher and @steinmb!
Comment #171
star-szrSome very nitpicky points but I think this could use just a tiny bit more love before it passes the finish line.
I think these two hunks should be reverted, the first one is just adding a newline out of taste from what I can see and the second one is removing a coding-standards appropriate comma: https://drupal.org/coding-standards#array
"file upload help text templates" maybe would be better here?
I think it would be better if we just added things to $variables['attributes'], this looks like we're currently clobbering everything coming in. I think that might be in scope to be added here but as long as that gets taken care of at some point I'm happy :) [in other words, if someone can create a followup that would be great <3]
Out of scope for this issue so I would lean towards leaving these lines alone…
Remove @ingroup themeable from this because it's a preprocess function.
Comment #172
joelpittetThanks @Cottser. I did 1,2,3, and 5 of the nitpicks in #171.
I am ok with #4 the minor docblock change because we are already cleaning up the docblock title by removing @ingroup themable so any conflict happens it would likely already happen due to the other changes surrounding that.
Comment #174
joelpittettypo, back to rtbc.
Comment #175
star-szrWorks for me, no interdiff though? :P
Comment #176
joelpittetOh sorry, I forgot, here's that interdiff between #166 and #174
Comment #177
webchickI'm really sorry, but this no longer applies due to #2089331: [meta] Replace calls to check_plain() with Drupal\Component\Utility\String::checkPlain(). Should be a quick re-roll, I hope.
Comment #178
joelpittetRe-rolled.
Comment #179
webchickGreat work, all!
Committed and pushed to 8.x. Thanks!