Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
block.module
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
10 Mar 2013 at 19:11 UTC
Updated:
29 Jul 2014 at 22:01 UTC
Jump to comment: Most recent file
Convert the following theme functions to use the new table #type:
| Module | Theme function name | Where in Code | What is it really? |
|---|---|---|---|
| block | theme_block_admin_display_form | template | table |
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | 1938898-26.patch | 5.09 KB | star-szr |
| #24 | interdiff.txt | 1.27 KB | saltednut |
| #24 | block-1938898-24.patch | 5.08 KB | saltednut |
| #23 | block-1938898-23.patch | 5.06 KB | saltednut |
| #23 | interdiff.txt | 3.68 KB | saltednut |
Comments
Comment #1
joelpittetComment #2
joelpittetComment #3
shanethehat commentedComment #4
Pete B commentedHi,
I had a quick look at this, and I'm not sure that the table #type is quite up to the challenge of converting this table yet? (And possibly it's beyond the scope of the #type to do so?)
I couldn't see a way of passing the colspans required to generate the headers for each region.
It looks like you would have to split this up into smaller tables (one for each region) and lose the sticky header that runs over the whole list. Which is probably not desirable...
Thanks,
Pete
Comment #5
joelpittetHi @Pete B thanks for having a crack. Though the solution isn't self evident I think it's to use
#wrapper_attributes
#1948374: #type 'table' allow attributes on table cells
Personally, I would prefer if it just treated #rows like it's #theme =>table wrapper does but there are reasons why it doesn't so I digress.
Do you think that would do the trick?
Comment #6
Pete B commentedJoelpittet,
Yes that does do the trick! If $form['blocks'] is a table #type, You can do something like:
To create a colspan for the header. Awesome!
Would be great to get an example on the documentation page. http://drupal.org/node/1876710
Thanks for the pointer!
Thanks,
Pete
Comment #7
shanethehat commentedComment #8
duellj commentedOk, this one was a bit tricky, and actually can't fully be converted to the limits of the table #type. In the original theme function, some custom code was used to stripe the table, skipping stripes on header and empty rows. There is a no_stripping option that can be set on theme_table, but there's no way to set that via the table #type.
Everything else in this patch should be fine though.
Comment #9
joelpittet#8: 1938898-8-block-table.patch queued for re-testing.
Comment #10
Pete B commentedLooking really nice... You actually can use no_striping as an #attribute. I have added this in.
The patch now matches the style of the original version. I also fixed some small coding standards on the tabledrag lines.
Thanks,
Pete
Comment #11
jibran#10: block-admin-to-type-table-1938898-10.patch queued for re-testing.
Comment #13
duellj commented#10: block-admin-to-type-table-1938898-10.patch queued for re-testing.
Comment #15
duellj commentedRelated to #2002222: Improve performance of block-admin-display-form.html.twig. Patch needs to be rerolled to remove the twig theme, since it was converted in #1898034: block.module - Convert PHPTemplate templates to Twig
Comment #16
mlncn commentedRe-rolled to apply despite the twig changes underneath, which fixes bugs introduced in the twig version too. Now to profile!
Comment #17
mlncn commentedPerformance profile is good! In summary:
Number of Function Calls 47,650 42,554 -5,096 -10.7%
Incl. Wall Time (microsec) 265,732 238,642 -27,090 -10.2%
Incl. CPU (microsecs) 200,012 176,011 -24,001 -12.0%
Incl. MemUse (bytes) 10,377,136 10,423,928 46,792 0.5%
Incl. PeakMemUse (bytes) 10,592,192 10,603,184 10,992 0.1%
Full XHProf profile attached. Using theme_table may increase memory usage slightly but is overall significantly faster.
The twig-ified block admin form before this patch appears broken to people, but it is in fact functional despite the messed up display; therefore tests relating to it were still passing. Further test coverage is *not* needed; we already know our tests can't catch all visual problems.
Comment #18
tim.plunkettI think this looks great. RTBC, but wait for the bot to come back.
Comment #19
alexpottCommitted d1a88e9 and pushed to 8.x. Thanks!
Comment #20
saltednutManual tests are showing changes to weight are not applying. I can move blocks around from region to region and save that, but the changes I make ordering by weight do not save (ie: change a weight from -2 to -4, click save, the block weight remains as -2). So we are still blocked for manual tests on #1987952: Blocks are not rendered in order by weight
Edit: I dug a bit further and I'm actually seeing that ALL blocks show up on admin/structure/block as having a weight of -2 now. However, when I look at the config files, the weight changes are being saved.
Edit2: Stood over @tim.plunkett's shoulder and watched him re-create the error but he is seeing all blocks as -4 and cannot see any changes persist when saving weight changes. Inspecting the config file showed that the weight changes were not being saved in the yml either.
Comment #21
tim.plunkettI RTBC'd this, I apologize, here's the fix.
The foreach loop was busted. It was using the $entity outside of the foreach, which explains why all blocks showed the same weight.
Comment #22
saltednutSo... one thing that has occurred to me as I begin writing tests for the block admin ui is that we won't be able to assert blocks are showing the correct weight in the ui without the modifications we're making todrupalPlaceBlockin WebTestBase with #1987952: Blocks are not rendered in order by weight. So it would seem there is some circular dependencies going on here. I suppose the thing to do would be to make the changes todrupalPlaceBlockin a patch here and then reroll #1987952: Blocks are not rendered in order by weight without those changes?Edit: Nevermind... patch including test coming.
Comment #23
saltednutIt would appear that BlockUiTest was empty. The attached should provide some more coverage - including what's relevant for @tim.plunkett's patch in #21.
Comment #24
saltednutSorry about the errors in #23 - this one should be better.
Comment #25
gábor hojtsyLooks good to me. The test extensions are especially welcome!
Comment #26
star-szrConflicted with #1980338: Fatal error: Class 'plugin.manager.block' not found in /core/modules/system/system.module on line 1162, here's a reroll, no changes.
Comment #27
alexpottCommitted 1936dbc and pushed to 8.x. Thanks!