Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Task
Convert the following theme functions to use the new table #type:
Module | Theme function name | Where in Code | What is it really? |
---|---|---|---|
book | theme_book_admin_table | function | table |
Steps to Reproduce
drush en book -y
- Add a book page at /node/add/book, and select "- Create a new book -" from the "Book Outline" tab
- Create another book page and assign it to the newly created book
- Visit /admin/structure/book/1
Related issues
- #1876712: [meta] Convert all tables in core to new #type 'table'
- #1898050: book.module - Convert PHPTemplate templates to Twig
Beta phase evaluation
Issue category | Task because it does not introduce any new features or removes any bugs |
---|---|
Issue priority | Normal because the functionality is unchanged |
Unfrozen changes | Unfrozen because it only converts the '#type' in the renderable array |
Prioritized changes | The main goal of this issue is removing previously deprecated code. |
Disruption | Not disruptive |
Comment | File | Size | Author |
---|---|---|---|
#70 | interdiff.txt | 8.41 KB | joelpittet |
#70 | convert_book_theme-1968982-70.patch | 11.16 KB | joelpittet |
#63 | interdiff.txt | 684 bytes | lauriii |
#63 | convert_book_theme-1968982-63.patch | 13.03 KB | lauriii |
Comments
Comment #1
duellj CreditAttribution: duellj commentedSplit off from #1898050: book.module - Convert PHPTemplate templates to Twig
Comment #3
duellj CreditAttribution: duellj commentedForgot to move tests over from #1898050: book.module - Convert PHPTemplate templates to Twig. Tests should pass now
Comment #4
catch#3: 1968982-3-book-table.patch queued for re-testing.
Comment #5
catchWill need a re-roll after #1938296: Convert book_admin_overview and book_render to a new-style Controller.
Comment #6
duellj CreditAttribution: duellj commentedNot sure this needs a re-roll, since #1938296: Convert book_admin_overview and book_render to a new-style Controller didn't touch book_admin_edit(). Are you talking about rolling that form into BookController?
Comment #7
duellj CreditAttribution: duellj commented#3: 1968982-3-book-table.patch queued for re-testing.
Comment #8
jibran#3: 1968982-3-book-table.patch queued for re-testing.
Comment #9
jibran#3: 1968982-3-book-table.patch queued for re-testing.
Comment #11
Brandonian CreditAttribution: Brandonian commentedPatch rerolled.
Comment #12
jibran#11: 1968982-11-book-table.patch queued for re-testing.
Comment #14
Hydra CreditAttribution: Hydra commentedRerolled the patch and fixed some bugs.
Comment #15
lokapujyaLooks pretty good. Maybe we should set the table ID? Previously, it was 'book-outline'.
Comment #16
lokapujyaComment #17
longwaveRerolled.
Comment #18
joelpittetThanks for the re-roll @longwave and it's green nice! There a couple of things and after those I'll give a manual test:
I think that is supposed to still be $node->label()
Not sure why this is needed?
All the t() can be $this->t to use the injected translations.
Comment #19
longwaveFixed all points raised in #18.
Comment #20
lokapujyaAny thoughts on whether we still want the table ID?
Comment #21
longwaveIf the table ID is not referenced anywhere in CSS or JavaScript, I don't see why we need it.
Comment #22
longwaveI think the ID was previously needed only for tabledrag, but not sure we need that any more, since #732022: drupal_add_tabledrag() still using drupal_add_(js|library)(), should return array for #attached was committed.
Comment #23
lokapujyaConflicting with #2084421: Phase 2 - Decouple book module schema from menu links
I'll attempt a reroll.
Comment #24
lokapujyaComment #25
lokapujya['operations'] conflicted, because the other patch had removed the ['href']. I am not sure if adding this back in breaks what they were trying to do in the other patch.
Comment #27
lokapujyaChange to a render array.
Change to route_name?
Comment #28
miraj9093 CreditAttribution: miraj9093 commentedrerolled ..
Comment #30
Jon PughOn it.
Comment #31
Temoor CreditAttribution: Temoor commentedPatch rerolled.
Comment #33
Temoor CreditAttribution: Temoor commentedUpdated tests, corrected errors from previous patch.
Comment #34
m1r1k CreditAttribution: m1r1k commentedComment #35
joelpittetNo longer applies, sorry I didn't get to review earlier, will after re-roll.
Comment #36
star-szrRerolled, some route names changed in the theme function in #2278567: Standardize node route names by relationship. Somewhat of an interdiff attached.
Comment #37
joelpittetI've got a feeling the book module is broken... create one book, no sub pages and save this edit form page:
http://d8.dev/admin/structure/book/1
And it borks up good before and after the patch (slightly different error though, regarding array flipping or missing table index... recoverable fatal). Will need to write a webtest or something, though I think that may need to go into a different issue if one doesn't exist.
Comment #38
lauriiiYeah, tried to test this patch but the book module is broken so the book page cannot be viewed.
Comment #40
cilefen CreditAttribution: cilefen commentedComment #41
cilefen CreditAttribution: cilefen commentedComment #42
cilefen CreditAttribution: cilefen commentedComment #43
kgoel CreditAttribution: kgoel commentedComment #44
kgoel CreditAttribution: kgoel commentedComment #46
lauriiiI was working on this reroll also so we did a bit double work.. But here's the differences from my patch
Comment #47
a-fro CreditAttribution: a-fro commentedDuring manual testing, the operations links were missing, though the text was there. I'm not sure if the other difference is relevant, but I've included a screenshot. @joelpittet, do you happen to know if the [parent] key matters? ie: name="table[book-admin-2][parent][pid]", vs. name="table[book-admin-2][pid]"
Comment #48
a-fro CreditAttribution: a-fro commentedAttaching the before and after txt files from patch 46.
Comment #49
a-fro CreditAttribution: a-fro commentedComment #50
a-fro CreditAttribution: a-fro commentedComment #51
a-fro CreditAttribution: a-fro commentedAfter looking at the code, I had these questions:
The $href here is funky.
These links no longer work. They are missing the a tags and hrefs when rendered to the page.
Comment #52
lauriiiThanks for your review @a-fro! Fixed the links :)
Comment #53
a-fro CreditAttribution: a-fro commentedManual test results below. Looks good to me! RTBC, @joelpittet?
Comment #55
idebr CreditAttribution: idebr commentedDid a manual test as well, looks clean.
Screenshot after:
Comment #56
alexpott#51 shows that we are missing test coverage here.
Comment #57
lauriiiComment #58
lauriiiAdded test coverage for the View link. It is currently not possible very easily to test Edit link because it requires 'administer nodes' permission which breaks some other stuff because of changed Save button on nodes. I think this should be fixed on a follow-up.
Comment #59
lauriiiComment #60
lauriiiInterdiff for my patch :)
Comment #61
lauriiiLittle clean up for docs & stuff
Comment #62
idebr CreditAttribution: idebr commentedThe 'limited' key is now hardcoded to 7. This should still use the BookManager::BOOK_MAX_DEPTH constant.
Comment #63
lauriiifixed #62
Comment #64
idebr CreditAttribution: idebr commentedThe feedback by alexpott in #56 was addressed, setting this back to RTBC and added a beta evalutation.
Comment #65
pwolanin CreditAttribution: pwolanin commentedlauriii asked me about the requirement for 'administer nodes' to use the operations. I suspect that was just done for speed and simplicity rather than checking each nodes. I don't think it should be changed in this patch, but could be examined in a follow-up.
Comment #66
joelpittetI didn't see this discussed earlier but wanted to point it out as it looks like it's not needed:
Is this change needed, it looks suspicious because we aren't using the row's values anywhere else.
Other than that, I'd leave it as RTBC, though if you want to throw in some short array syntax for good measure that'd be cool too;)
Comment #67
robmc CreditAttribution: robmc commentedComment #68
lauriii@robmc: did you find find any other solution to fix that? I checked but the 'nid' item doesn't exist in $values array anymore.
Comment #69
joelpittet@lauriii robmc was working it, he may have a patch to get most of the way there. Essentially the 'nid' was moved onto the 'parent' in the values, and it shouldn't get moved there, which may constitute an API change. So we just need to move that back.
Comment #70
joelpittet@lauriii here's an attempt, I left the ['parent'] key in the form because those form elements need to be in a column and that one makes sense, just removed the parent key from the #parents within FAPI which preserves the $form_state values and leaves the tests and submit handler mostly alone.
Also did all the array short syntax changes that didn't affect the patch size.
Local tests aren't working well for me on the command line or the UI, but manual testing was fine and the values were the way they should be on the submit handler, so here's hoping testbot agrees;)
Comment #71
lokapujyaComment #72
lokapujyaWhile manual testing, noticed that the weights for new pages are negative numbers, whereas in Drupal 7 they are 0. Noticed that when "show weights" is selected, we show the parent column (with nothing in it) but that's the same as Drupal 7. Both are unrelated to this issue, I think.
RTBC+1.
Comment #73
lauriiiAfter manually testing this I don't see any regressions. Also code looks good. I also like the fancy array syntax used in the patch ;)
Comment #74
lokapujyaarray() is sooooo php5.4.
Comment #75
joelpittet5.3 but yeah... agreed:P
Comment #76
alexpottCommitted 0f2348c and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.