Opened 11 years ago
Last modified 5 years ago
#27299 new enhancement
Order the available widgets in the Widgets admin page
Reported by: | nofearinc | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Widgets | Keywords: | has-patch needs-refresh |
Focuses: | administration | Cc: |
Description
The list of available widgets is always sorted alphabetically. Adding a hook would allow us to prioritize the order.
Sample patch attached.
Attachments (2)
Change History (9)
#1
@
10 years ago
- Focuses accessibility removed
The new filter will need hook documentation.
The filter should probably exists here too: trunk/src/wp-includes/class-wp-customize-widgets.php@29903#L864
#4
@
10 years ago
- Keywords 2nd-opinion added
I have some concerns about the placement of the filter. If it's specific to ordering the widgets it should be tied specifically to a sorting function, such as maybe making the _sort_name_callback
callback filterable.
I can easily see this getting misused for doing things like removing widgets from the list altogether or otherwise manipulating the list in ways that fall far outside the scope of simply changing the order.
If general filtering here is something we want to promote, great, rename the filter. If not, then maybe we should reconsider the implementation.
#5
@
10 years ago
I would personally embrace complete filtering - restricting it doesn't make sense as a simple admin JS could hide it, similarly to what we did for live search filtering as mentioned in #27151. That said, _sort_name_callback
would also be tricky if it's filtered since name ordering won't be the case anymore for some of the filters.
If the name is troubling, I can update the hook name to filter_available_widgets
or something like that.
propose a available_widgets_order filter