Opened 12 years ago
Last modified 4 years ago
#23253 reopened enhancement
Lack of a do_settings_section (singular) function
Reported by: | auniquename | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Plugins | Keywords: | has-patch |
Focuses: | administration | Cc: |
Description
After considerable research I have found that plugin authors, including myself, have to go to great lengths to put options into tabs on a plugin settings page. The majority use JavaScript to modify the DOM in order to achieve this, others have broken their options into several settings arrays instead of the recommended single array to facilitate the creation of tabs using the traditional WordPress nav-tab-wrapper class approach.
To get my own options into tabs in a fully scoped css jquery ui theme I ended up adding my own hacky function to my plugin: myplugin_do_settings_section( $page, $sectionid ) - which is just a copy of the core function do_settings_sections( $page ) with an additional parameter for the section id and an added conditional to only output the section with the requested id.
This allows me to wrap each section in the appropriately classed tags for either jquery ui tabs or traditional WordPress nav-tabs. This however, is not an acceptable long-term solution as the core code will undoubtedly change, I already see tickets and revisions relating to the removal of those nasty tables...
This functionality should be in the core code. A settings section is a section and it should be possible to output them one at a time to allow for styling.
Thanks for considering my proposal.
(Also, the Iris color picker does not play nice with jquery-ui - it needs its own css scope or something - that will be a separate ticket once I have a better understanding of what is wrong with it and have searched for existing tickets on the subject.)
Attachments (1)
Change History (9)
#3
@
9 years ago
- Keywords needs-patch added
- Milestone Awaiting Review deleted
- Resolution set to maybelater
- Status changed from new to closed
Closing as maybelater. Complete lack of interest on the feature on the ticket over the last 2 years. Feel free to reopen when more interest re-emerges (particularly if there's a patch)
#4
@
9 years ago
- Resolution maybelater deleted
- Status changed from closed to reopened
- Version set to 4.4
I agree that this functionality should be in the core code. Reasons:
- Many plugin and theme developers need it.
- This functionality can stop a large number of ugly and inconsistent settings pages.
#6
@
9 years ago
Another vote for this from a plugin author. It's not a big function to add -- but best to have it standard.
#8
@
4 years ago
- Keywords has-patch added; needs-patch removed
I came across this ticket earlier after searching for a "do_setting_section" function.
I've attached a suggestion for a patch, adding a do_setting_section() function, as well as a render_setting_section() function that is used by it - and also by a refactored version of do_setting_sections() to avoid code duplication.
render_settings_section() is not something I'd expect to be used outside of these circumstances, and this being my first patch, I wasn't sure on naming conventions for "private" functions.
Feedback appreciated!
Sorry for the noise.