[wp-trac] [WordPress Trac] #21488: Add Default Callback Functions for add_settings_field()

WordPress Trac noreply at wordpress.org
Fri Aug 23 12:16:02 UTC 2013


#21488: Add Default Callback Functions for add_settings_field()
-------------------------------------------------+-------------------------
 Reporter:  mordauk                              |       Owner:
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  Future
Component:  General                              |  Release
 Severity:  normal                               |     Version:
 Keywords:  has-patch dev-feedback settings-api  |  Resolution:
-------------------------------------------------+-------------------------

Comment (by cfoellmann):

 Added an $args array to the function
 {{{
 add_settings_section( $id, $title, $callback, $page )
 }}}

 which results in
 {{{
 add_settings_section( $id, $title, $callback, $page, $args = array() )
 }}}

 Example functions:


 {{{
 function register_some_settings() {
         add_settings_section(
                 'some_id', // $id
                 'Some Title', // $title
                 'generate_section', // $callback
                 'some_page', // $page
                 array(
                         "desc" => "some text for the section description"
                 )
         );

         // add some fields ...

         add_settings_section(
                 'some_other_id', // $id
                 'Another Title', // $title
                 'generate_section', // $callback
                 'some_page', // $page
                 array(
                         "desc" => "A DIFFERENT text for the second
 section's description"
                 )
         );
 }

 function generate_section( $args ) {
         echo '<p>' . $args['desc'] . '</p>';
 }
 }}}

--
Ticket URL: <http://core.trac.wordpress.org/ticket/21488#comment:40>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list