[wp-trac] [WordPress Trac] #18285: New Settings API and workflow
WordPress Trac
wp-trac at lists.automattic.com
Thu Jul 28 21:03:43 UTC 2011
#18285: New Settings API and workflow
----------------------------+------------------
Reporter: nacin | Owner:
Type: task (blessed) | Status: new
Priority: normal | Milestone: 3.3
Component: Plugins | Version:
Severity: normal | Resolution:
Keywords: |
----------------------------+------------------
Changes (by prettyboymp):
* cc: mpretty@… (added)
Comment:
Here is a wrapper I wrote to simplify the headache of creating settings:
https://github.com/prettyboymp/voce-settings-api. It isn't written in the
usual way WordPress does things, and isn't a complete integration as it
updates it calls update_option() directly, but I thought it may offer some
useful insight.
One feature that is really helpful is that it allows for different plugins
to share a page or even group (section) without interfering with each
other. This allows us to add/remove/share modules without having
dependencies or having to have multiple option pages.
Below is an example of how pages/groups/settings are added:
{{{
Voce_Settings_API::add_page( 'Blog Settings', 'Blog Settings', 'blog-
settings' )
->add_group( 'Related Story Feeds', 'related-story-feeds' )
->add_setting( 'Related Videos Feed', 'related-videos',
array('sanitize_callbacks' => array('sanitize_url')) )
->group
->add_setting( 'Related Stories Feed', 'related-stories',
array('sanitize_callbacks' => array('sanitize_url')) );
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18285#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list