Problem/Motivation
Theme hook "file_widget" lives in core but is not used. File widget uses "file_managed_file" instead.
Proposed resolution
Remove unused theme hook.
Original issue summary
Part of #2025629: [PP-1] [meta] Ensure that all #theme/#theme_wrappers hooks provided by core are associated with a sensible, re-usable element #type. Not sure if I prefer 'file_managed_file' or 'managed_file' but the two should share the same name as they're just two parts of the same thing.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | remove_unused_theme-2025707-16.patch | 4.4 KB | joelpittet |
| #16 | interdiff.txt | 772 bytes | joelpittet |
| #12 | remove_unused_theme-2025707-12.patch | 3.65 KB | joelpittet |
| #9 | remove_unused_theme-2025707-9.patch | 5.58 KB | joelpittet |
Comments
Comment #1
joelpittetWondering if 'widget' should be in the name, because 'file_widget' extends from #type 'managed_file'
Comment #2
thedavidmeister commentedWhat about 'managed_file' for the #type/#theme and 'managed_file_widget' for the widget extending the base #type?
Comment #3
joelpittetThat makes sense to me! I wonder if we can still get this kind of change in for D8 beta?
Comment #4
slashrsm commentedNot sure if this is related or not...
I was looking into this while trying to solve another issue and realized that
file_widgettheme isn't even used any more. It seems thatfile_managed_filegets picked every time instead of it.As part of #2511036: image-widget.html.twig never gets used (image_widget gets overridden by FieldWidget::process) this hunk went in:
Intent of this hunk was to prevent file widget from overriding theme that image widget sets. Since file managed element sets theme to
file_managed_filethis condition always stays unsatisfied andfile_widgettheme unused as a result of that.I am wondering if we need
file_widgetat all?Comment #5
star-szr@slashrsm we probably don't need it in core but I'm thinking the fact that it's there and it's RC means we can't remove it.
Comment #6
slashrsm commented@Cottser: I had the same thought too. This probably means D9 material?
Comment #7
slashrsm commentedComment #8
catchThis is very confusing and I think we should consider it as borderline 'dead code removal' for an RC target.
If a module is relying on this, I'd be very surprised.
If not, we should at least deprecate it somehow.
Comment #9
joelpittetRemoved, let's see what happens:)
Comment #10
andypostLooks great, except following
how this change related?
Comment #11
star-szrYeah I think there's some definitely some unrelated changes in there.
Comment #12
joelpittetWhoops, thanks for the review. Well all works;)
Comment #13
star-szrLooks good my only thought is there's maybe some code that would be dead in core/modules/file/file.js as a result:
Found that grepping for file_widget and file-widget.
Comment #14
slashrsm commentedThat JS is not dead. It is still used by file/image widget. Standard install, node/add/article, upload an image in image field, image link that appears is handeled by that code.
In JS console on the same page:
Comment #15
star-szrI'm not saying all those lines of JS are dead but the
.file-widget .file aselector sure seems like it would be :)Comment #16
joelpittetI agree, not changing status because I believe that is all the things.
Comment #17
effulgentsia commentedI discussed this with @xjm to triage, but @catch wasn't online. Assigning to him, so that we figure it out when he is.
Comment #18
effulgentsia commentedAh, comment #4 explains why/how
file-widget.html.twigis currently dead code. Yeah, this is better to clear up pre-release than have to support until 9.x.Comment #19
catchCommitted/pushed to 8.0.x, thanks!
Comment #21
nod_