
Problem/Motivation
On the Single config export form at /admin/config/development/configuration/single/export
, when looking at the Block list of Configuration options, it's sorted alphabetically by label, with the machine name in parenthesis after. For example: Help (claro_help)
Normally when you're exporting config, you know what the machine name is, but not necessarily the label. This makes it extremely difficult to find the config you need, when the list is hundreds or thousands of options long.
However, if you simply switch the order to be machine name, then label, eg. claro_help (Help) then it's easy to find the config you want.
I added a patch to core/modules/config/src/Form/ConfigSingleExportForm.php
that swaps the order in the dropdown.
Steps to reproduce
- Log in and go to
/admin/config/development/configuration/single/export
- Under Configuration type select Block.
- Open the Configuration name dropdown
- See the order is based on label, not machine name.
Proposed resolution
Switch the order so the machine name comes first in the label. Then it will be sorted alphabetically before display.
Remaining tasks
None.
User interface changes
Changes the order of the options in the Configuration name dropdown.
Before:
After:
API changes
None.
Data model changes
None.
Release notes snippet
None.
Comment | File | Size | Author |
---|---|---|---|
#24 | after.png | 376.71 KB | dishakatariya |
#23 | before.png | 372.68 KB | dishakatariya |
#20 | Screenshot 2023-12-01 162700.png | 185.17 KB | nitin shrivastava |
#20 | Screenshot 2023-12-01 160007.png | 114.25 KB | nitin shrivastava |
#18 | after.png | 139.94 KB | samlerner |
Issue fork drupal-3399152
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mile23Comment #3
smustgrave CreditAttribution: smustgrave at Mobomo commentedThink such a change will require test coverage.
Would recommend an MR as patches are phased out and don't auto run the tests anymore. I'll trigger though.
Comment #4
samlerner CreditAttribution: samlerner at CivicActions for Centers for Medicare and Medicaid Services commentedYes, I was admittedly being lazy by attaching a patch. :) but now I'll make an MR so I can add tests.
Comment #6
samlerner CreditAttribution: samlerner at CivicActions for Centers for Medicare and Medicaid Services commentedCreated an MR with the change to the dropdown, and a test to verify that the options are being sorted alphabetically. Hiding the patch file.
Comment #7
smustgrave CreditAttribution: smustgrave at Mobomo commentedRan the test-only feature in gitlab but the test did not fail. See https://git.drupalcode.org/issue/drupal-3399152/-/jobs/296610 so leaving that tag.
Also seems some existing tests have failed.
Comment #8
samlerner CreditAttribution: samlerner at CivicActions for Centers for Medicare and Medicaid Services commentedThere was another functional test that was checking config name labels, and it needed the id/label reversed. Updated that test and pushed up the changes, looks like everything's passing now.
Comment #9
samlerner CreditAttribution: samlerner at CivicActions for Centers for Medicare and Medicaid Services commentedComment #10
smustgrave CreditAttribution: smustgrave at Mobomo commentedTest-only feature is failed.
But there is an open thread from @zniki.ru
Comment #11
samlerner CreditAttribution: samlerner at CivicActions for Centers for Medicare and Medicaid Services commentedI figured out the test block creation part by using
BlockContentSaveTest::createBlockContent()
as an example. Once I then figured out I needed to use$this->drupalPlaceBlock
inside mysetUp()
method, I was good to go.Comment #12
samlerner CreditAttribution: samlerner at CivicActions for Centers for Medicare and Medicaid Services commentedComment #13
nikolay shapovalov CreditAttribution: nikolay shapovalov as a volunteer commented@SamLerner thanks for updating the test scenario. MR looks good, I add some comments, please check and provide feedback.
Comment #15
samlerner CreditAttribution: samlerner at CivicActions for Centers for Medicare and Medicaid Services commentedComment #16
nikolay shapovalov CreditAttribution: nikolay shapovalov as a volunteer commentedThanks for MR update. Looks good. RTBC.
Comment #17
xjmI'm not totally sure about this change, so tagging for subsystem maintainer review. Additionally, since this is intended as a usability improvement, it should have embedded before and after screenshots in the issue summary.
Posted a few points on the MR as well. Thanks!
Comment #18
samlerner CreditAttribution: samlerner at CivicActions for Centers for Medicare and Medicaid Services commentedComment #19
samlerner CreditAttribution: samlerner at CivicActions for Centers for Medicare and Medicaid Services commentedMade all the code updates and attached before/after screenshots.
Comment #20
nitin shrivastava CreditAttribution: nitin shrivastava at OpenSense Labs commented@SamLerner MR#19 has been successfully applied, and now the dropdown will open in the 'config export' based on the machine name.
Before Patch
After Patch
Comment #21
samlerner CreditAttribution: samlerner at CivicActions for Centers for Medicare and Medicaid Services commentedIs there anything else needed for this issue?
Comment #22
xjmThe issue still needs subsystem maintainer signoff for the user expectations of this developer-facing form. @alexpott or @tim.plunkett are maintainers of relevant related subsystems.
Comment #23
dishakatariya CreditAttribution: dishakatariya as a volunteer and at QED42 for Drupal India Association commentedHi, Verified and tested (#20) by taking pull from the latest branch 3399152-change-sort-order on 11.x version. The changes were made are looking fine to me.
Followed the below steps:
1. Log in and go to /admin/config/development/configuration/single/export
2. Under Configuration type select Block.
3. Open the Configuration name dropdown
4. See the order is based on label, not machine name.
Attaching screenshot for reference.
Thanks
Comment #24
dishakatariya CreditAttribution: dishakatariya as a volunteer and at QED42 for Drupal India Association commentedComment #25
alexpottThis seems like a better way of presenting this information. Nice one.
Comment #26
samlerner CreditAttribution: samlerner at CivicActions for Centers for Medicare and Medicaid Services commentedThanks! I find it extremely useful because when I'm going to export single configs, I usually know the machine name, as that's what's displayed on the Config Synchronization page at
/admin/config/development/configuration
. Trying to sort through hundreds of configs by label was pretty time-consuming.Comment #27
smustgrave CreditAttribution: smustgrave at Mobomo commentedThanks @alexpott!
Removing screenshots tag as they appear in the issue summary.
Confirmed applying the MR I'm seeing the configuration sorted by machine name.
Comment #28
alexpottCommitted 4b3313c and pushed to 11.x. Thanks!
Comment #30
wim leersNice improvement! 😊