Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
theme system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Jul 2013 at 00:12 UTC
Updated:
29 Jul 2014 at 22:42 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
pplantinga commentedHere's a patch
Comment #2
plopescHello.
It looks good to me. Maybe you could add a minor improvement.
You could save some lines and avoid misspellings assigning values for '#alt' and '#title' in the same line
$image['#alt'] = $image['#title'] = t('error');.Regards.
Comment #3
cconrad commentedTrying to patch the patch (core office hours - nick cconrad - assigned by heddn)
Comment #4
pplantinga commentedI have to say I disagree. For one, I don't think of "saving lines" as a worthwhile goal, since whitespace generally helps readability, and two, i think
is less clear (less readable) than
Also, maybe someday we'll want to have different values or remove one of these. This makes it easier to change and makes the patch more readable too.
Comment #5
cconrad commentedImplemented the improvement suggested by plopesc in #2
Comment #6
cconrad commentedI patched this because I got it in Drupal Office Hours, but I tend to agree with pplantinga, the original patch is more readable.
Comment #7
cconrad commentedHow about this compromise - avoids misspellings, only one call to t(), and better readability?
Comment #8
pplantinga commentedLooks like you tried to edit the patch directly? Trying to apply the patch in #7 gave: fatal: corrupt patch at line 128
Git tends to not like it when you edit a patch, so it's better to apply the patch, make the changes, and generate a new patch.
I could live with the changes suggested in #7, when there's a valid patch.
Comment #9
cconrad commentedRight. I'll get back to this with a fixed patch.
Comment #10
plopescHello
@pplantinga:
I understand your point. It was a suggestion, that you can take or not. Maybe other more experienced contributors could give their opinion in order to follow one approach or the other.
@cconrad:
Thanks for your approach, It's a different point and it will be take into account.
Different points of view are good and that's the way to improve the Drupal code, everyone can say and then, decide the best option.
Regards
Comment #11
cconrad commentedIn case you decide to use the "compromise" from #7, here's a fixed patch that hopefully passes.
Comment #12
plopescHi,
Here are my two cents about this issue. This patch moves the
$imagearray definition below the switch call. Then, the whole renderable array is built in a single step, and its properties are declared in that switch depending on the project status.What do you think about it?
Regards.
Comment #13
plopescSorry, my previous interdiff was bad named.
Attaching with correct name.
Comment #14
pplantinga commentedLooks good to me. Let's see if testbot likes it.
Comment #15
pplantinga commentedLooks like testbot likes it too.
Comment #16
alexpottThis seems to be occurring in the wrong place. the first time around $image is not going to exist...
Just do this instead
Comment #17
plopescD'oh!
It was fast patch without the necessary review from my side.
Re-rolled.
Thanks for your hard work @alexpott
Comment #18
jenlamptonThanks for the quick update @plopesc
Comment #19
catchIs it really necessary to use #markup, why not have the table as a child and let it get rendered later?
Comment #20
plopesc@catch, you're right, It's not necessary ;)
Re-rolling using
'#type' => 'table'instead of'#markup' => drupal_render()Thanks
Comment #21
thedavidmeister commentedWhy is one of the tables using #theme and another using #type?
Both should probably use #type, as per #1876712: [meta] Convert all tables in core to new #type 'table'.
Also, as I understand from reading over that issue, #type 'table' expects rows to be provided as child elements rather than in #rows.
Comment #22
thedavidmeister commentedActually, the patches would be easier to review if we kept the tables as #theme 'table' for now, and let the other meta issue handle converting from #theme to #type - that's how other patches on sibling issues to this issue have handled tables.
Comment #23
pplantinga commentedHow about this?
Comment #24
thedavidmeister commentedseems fair.
Comment #25
alexpottCommitted 53731f9 and pushed to 8.x. Thanks!