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.
This patch catches the returning form and sorts the #options before displaying with a simple asort();
Index: /Users/jbitner/Sites/myplay/public_html/sites/all/modules/contrib/views/views_ui.module
===================================================================
--- views_ui.module (revision 2104)
+++ views_ui.module (working copy)
@@ -1716,6 +1716,7 @@
* Render the add buttons for one of the dynamic sections on our form.
*/
function views_ui_render_section_add(&$form, $items, $label) {
+ asort($form['id']['#options']);
foreach ($items as $item) {
$row[] = drupal_render($form[$item], false);
}
Comment | File | Size | Author |
---|---|---|---|
#5 | views.patch | 635 bytes | mvc |
Comments
Comment #1
mvcWorks perfectly for me, and makes my views far easier to edit.
Comment #2
JohnAlbinThis should be submitted as an attached patch file.
Also, the problem description is so short I don't even know what the change is supposed to accomplish.
Comment #3
mvc@JohnAlbin: I've created a separate patch file and attached as requested.
The 'problem' is that often the views ui generates very long dropdown lists in no particular order, making it hard to find (for example) the CCK field you wish to add as a field to a view. By simply sorting the list, it becomes very easy to find a particular field.
Obviously, this isn't required for the views module to work correctly, but it makes it much simpler to use, and I don't see any reason not to add this asort.
Comment #4
sunPlease submit a proper patch. If you do, it has a good chance to be included in 1.7.
Comment #5
mvcOops, sorry, I thought I had attached that file. Here you go.
Comment #6
sunThanks, committed.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #8
regx CreditAttribution: regx commentedCool that this has been added to views. I created a small module to do this as well as add several other sort options.
The asort is the simplest and most effective for me, but I had request for several other sort methods.
Curious if anyone else finds the other sort options useful, or if I should abandon my module?
http://drupal.org/project/view_ui_sort
Comment #9
mroswell CreditAttribution: mroswell commentedWhere can I find views 5.x-1.7? There's no recent dev release showing on the module page for 5.x.
Comment #10
sunThe development snapshot for 1.x is visible on the project page now.
Comment #11
mroswell CreditAttribution: mroswell commentedThanks!