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.
Follow-up to #1938912: Convert language content setting table theme to a twig template
Task
Convert the following theme function to use the new table #type:
Module | Theme function name | Where in Code | What is it really? | Fixed in |
---|---|---|---|---|
language | theme_language_negotiation_configure_browser_form_table | function | form table |
Steps to reproduce/review
- Install Drupal 8, and enable the language module.
- Visit admin/config/regional/language/detection/browser.
- Confirm that the Browser Language Detection Configuration table displays correctly in HEAD and with the patch applied.
- Delete all of the default browser language items so that the table contains no items.
- Confirm that the empty message text "No browser language mappings available." is correctly displayed in HEAD and with the patch applied.
Next steps
Before
Empty:
Two Languages:
After
Empty:
Two Languages:
Related issues
Comment | File | Size | Author |
---|---|---|---|
#24 | interdiff-2422481-12-24.txt | 597 bytes | akalata |
#24 | convert_language_negotiation_table-2422481-24.patch | 4.49 KB | akalata |
#12 | convert_language_negotiation_table-2422481-12.patch | 4.52 KB | akalata |
#12 | interdiff-2422481-7-12.txt | 755 bytes | akalata |
#7 | interdiff-2422481-4-7.txt | 1.92 KB | akalata |
Comments
Comment #1
lokapujyaComment #2
lokapujyaStarter patch.
Comment #3
lokapujyaTodo: Add #empty and #attributes back in.
Comment #4
akalata CreditAttribution: akalata commentedUpdating issue summary with steps to reproduce and issue next steps, along with posting a reroll.
Comment #5
akalata CreditAttribution: akalata commentedComment #6
dawehnerThese changes are out of scope, IMHO. Its just converting to short array syntax
Comment #7
akalata CreditAttribution: akalata commentedThanks @dawehner! The attached patch addresses feedback in #3 and #6.
Comment #10
lokapujyaProbably need to add this in a different way.
Comment #11
akalata CreditAttribution: akalata commented@lokapujya there are notices for the #attributes, which I will work on now, but the #empty seems to be working fine?
Comment #12
akalata CreditAttribution: akalata commentedAccording to this change record, the Attributes object must be initialized with an empty class array.
Comment #13
joelpittetOnly reason to use this is if we are adding classes later on. But a better approach would be to use
addClass()
and it will ensure theAttributeArray
class gets created.But recommendation that this is not needed because I can't see where a class is being set on that table.
Comment #14
joelpittetI guess the answer here is we don't need to instantiate an Attribute object with #attributes, we can just pass it an array.
Comment #15
akalata CreditAttribution: akalata commentedComment #16
joelpittetComment #17
akalata CreditAttribution: akalata commentedLet's try this one instead.
Comment #18
joelpittetRTBC for convert_language_negotiation_table-2422481-16.patch
As it was a minor change that already proved to pass and I've manually tested with screenshots in #16
Comment #20
lokapujyaWhat just happened between #12 and #15? NM, I see that #16 ignores it.
Comment #23
star-szrComment #24
akalata CreditAttribution: akalata commentedRenaming/reposting correct patch from #17, since I keep getting confused.
Comment #25
star-szrGave this another spin and I can confirm everything works as expected and the patch looks good. Thanks @akalata!
Comment #26
lokapujyaDo we need this anymore?
RTBC++ after that.
Comment #27
webchickWow, the diffstat here is insanely better! Great work.
PHPStorm agrees with #26, so removed that line and...
Committed and pushed to 8.0.x. Thanks!