[wp-trac] [WordPress Trac] #21488: Add Default Callback Functions for add_settings_field()
WordPress Trac
wp-trac at lists.automattic.com
Mon Aug 6 16:53:27 UTC 2012
#21488: Add Default Callback Functions for add_settings_field()
-------------------------+------------------------------
Reporter: mordauk | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch |
-------------------------+------------------------------
Changes (by mordauk):
* status: new => closed
* resolution: => fixed
Comment:
Replying to [comment:7 scribu]:
> How about, instead of overloading the callback arg, you just skip it
entirely and use a 'type' option instead? For example:
>
> {{{
> $args = array(
> 'type' => 'select',
> 'choices' => array(
> 'one' => 'The Choice Name',
> 'two' => 'The Second name',
> 'three' => 'The Third option'
> ),
> 'description' => 'This is a dropdown.'
> );
>
> add_settings_field( 'pw_sample_option', 'A Sample Setting', false,
'general', 'pw_sample_section', $args );
> }}}
>
> Starts to look a lot like Customizer fields, don' it?
jbobich and I thought about that for a while and ultimately thought it
made more sense to overload the callback instead of having a type option
in the $args parameter. The default field types we've proposed here are
still callbacks in terms of what they do, so I don't think they should be
separated. I have a feeling it would get confusing for users if they saw
that they could define a callback AND a type but only one could actually
be used. There would be some users who would create a text field callback
and then also set the type to "text" not realizing that only one or the
other was necessary.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21488#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list