Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
theme system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
1 Jun 2013 at 04:17 UTC
Updated:
29 Jul 2014 at 22:27 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
samvel commentedComment #1.0
samvel commentedadd related issue
Comment #1.1
samvel commentedappend related issue
Comment #2
samvel commentedattached
Comment #2.0
samvel commentedappend related issue
Comment #4
samvel commentedattached new one
Comment #6
andypostre-roll
Comment #8
thedavidmeister commentedfeel free to re-assign if you're still working on this @Samvel
Comment #9
hussainwebI was trying to reroll this patch when I came across a few issues about which I am not entirely sure.
In block.admin.inc and HelpController.php, render arrays are replaced with calls to drupal_add_css. Such as:
This is replaced with:
I was in an impression that we are moving towards render arrays for everything. Please clarify.
Another issue I faced was in core/modules/node/node.admin.inc. The patch introduced a change in node_multiple_delete_confirm_submit() but it seems that this function (and many others) are completely removed. I checked the documentation and they seem to be removed.
Lastly, I don't see why this patch removes core/modules/system/lib/Drupal/system/Tests/InstallerTest.php and modifies scripts in core/scripts/generate-d7-content.sh and core/scripts/generate-d6-content.sh.
But in good faith, I have just gone ahead and rerolled the patch. Please set the issue to 'needs review' if you think the above issues are not problems.
Comment #10
pplantinga commentedAgreed on those issues. Also, many changes, while they could be good ones, were unrelated to this issue.
Here's a new patch. Just a quick question, do we care about theme() calls in tests? This patch only covers image.admin.inc and image.file.inc, not any test files.
Comment #12
pplantinga commentedArgh, decided I'd add an "alt" tag to preview images, didn't know that tests depended on not having it. Whoever reviews this should look at questions I had in #10.
Comment #13
jenlamptonYeah, we should remove the theme calls in tests as well. Do you want to take a stab at adding those in?
Comment #14
pplantinga commentedStuck on #2030243: Remove theme_file_upload_help() from the theme system
Comment #15
pplantinga commentedOnce the aforementioned issue is in, then this patch should do it.
Comment #16
c4rl commentedHow is #2030243: Remove theme_file_upload_help() from the theme system not accommodated by, and thus duplicate of this present issue?
Comment #17
pplantinga commentedThe name for the issue was not as clear as it could have been, since i came across it while working on this issue. I've just renamed it. It looks like a resolution is near for the issue, so it shouldn't matter that much either way.
Basically that issue is about a FAPI conflict in a file.module theme function, which appears in more places than just the image module. I felt it deserved a separate issue.
Comment #18
pplantinga commentedRe-roll patch, again assuming that #2030243: Remove theme_file_upload_help() from the theme system gets in.
Comment #19
eric_a commentedMixing up elements like this is a bad idea. It just so happens that there (currently) is no conflict here between the properties of the two elements, but we should just separate these properly. Especially if we want to do #2035977: Introduce #type elements for base theme hooks in image.module.
Type item by default does not declare #theme and does declare #theme_wrappers, so we should try something like this:
Comment #20
eric_a commentedIt might not even work still.In many cases it will just work: the rendered children of the item will be concatenated with an empty #markup property string.Safest would be to just populate the #markup property, with a #pre_render. EDIT2: #pre_render would perhaps be out of scope for these straight conversions I guess. Just a direct drupal_render() then. This would mean that the current patch is already taking an out of scope approach here.
Comment #21
thedavidmeister commented#19 just looks to me like a workaround for a bug - that you can't use #theme_wrappers => array('form_element') with 'file_upload_help'. We could move this issue forward using that approach, but I don't see any harm in cleaning up the namespace conflict with the FAPI first.
Comment #22
eric_a commentedYou can use any #theme_wrapper you like. And combine it with any fitting #theme. The point is that you must not merge elements of different types into one level. That can always lead to conflicts. There is no way to solve that.
Comment #23
thedavidmeister commentedThis is true. At this point though, I don't think 'file_upload_help' is a #type.
Comment #24
eric_a commentedYeah, I should have said:
Different elements cannot just be merged into one element on one level.
Every single element has its own properties (explicit or implicit as type defaults), be it #input, #markup, #theme, #theme_wrappers, #description. Merging elements will lead to conflicts.
So they must live as a siblings or a children. Of course, when early rendering into a string every type can be stuffed into #markup.
Comment #25
eric_a commentedHow would you convert this example?
I can come up with three options:
In many ways the third seems best. But for alterable structures moving the contents of #markup to newly invented children is API breakage.
Even when there is only one theme function used to build #markup, I think you should still not try and merge it into another element. It's messy and many a time it won't even be possible.
Note that if there was a #theme property involved (explicit or implicit as type default) the children would not be rendered by drupal_render() itself. They would have to be taken care of by the theme function.
Comment #26
thedavidmeister commentedTrue dat. Given that we're past the 1st of July, I think option one for the conversion would be the most palatable.
It also follows the instructions in the parent issue:
Comment #27
thedavidmeister commentedComment #28
pplantinga commentedUpdated patch.
Comment #30
pplantinga commentedd'oh.
Comment #31
pplantinga commentedLooks like test bot likes it. I forgot to mention that I addressed issue raised in #19.
Comment #32
sbudker1 commentedLooks like this needs a reroll!
Comment #33
hussainwebRerolled...
Comment #34
thedavidmeister commentedAre we 100% sure this doesn't change the behaviour of this theme function? url() processes urls passed to l(), which may be good/bad/neutral here, but are we ok with this change? it looks out of scope for a straight conversion of the theme() function.
Any reason this render array's variable name doesn't match the naming convention established in the parent issue?
This looks out of scope for this conversion. Although it does look worthy of it's own issue.
Again, conversion to l() looks out of scope here.
This changes the trailing whitespace in the output in the case that $variables['data']['upscale'] is falsey, this change is out of scope for this conversion.
Comment #35
pplantinga commentedJust a better variable name, more descriptive, more consistent and all that. I've changed it to $image in the latest patch though.
I've verified that the output is identical... does that help? Converting theme() to l() is indirectly changing theme() to drupal_render() since l() calls drupal_render(). That's my angle, at any rate. I've attached two patches, with and without that change.
The rest should be fixed as well.
Comment #36
pplantinga commentedComment #38
thedavidmeister commentedI personally think it's probably a good thing, I'm just suspicious that there may have been a reason for that link to be manually concatenated rather than using l() "once upon a time" and that reasoning may or may not still hold true. I wanted to direct people's attention towards it simply to invite discussion - I'm ok with including it if everyone else is.
Comment #39
pplantinga commented#35: replace-theme-image-module-no-l-2009580-35.patch queued for re-testing.
Comment #40
siccababes commentedIt needed a re-roll
Comment #41
siccababes commentedComment #42
thedavidmeister commentedThis looks good to me. If there are any further changes, can we please get an interdiff on each update? It's long enough to justify them.
Comment #43
claudiu.cristeaRelated issue: #1898420: image.module - Convert theme_ functions to Twig.
Comment #44
alexpottSo this change makes it possible for $image['#uri'] to not be set. Why are we changing the logic here (in a conversion issue)
Comment #45
pplantinga commentedRe-rolled and updated with changes in #44
Comment #46
drupalmonkey commentedComment #47
drupalmonkey commentedImages are loading correctly in the admin area and on a node. Ran the tests for image module locally with patch and came back green. Setting RTBC.
Comment #48
alexpottCommitted 3f97e8c and pushed to 8.x. Thanks!
Comment #49.0
(not verified) commentedappend @ to related tasks