[wp-trac] [WordPress Trac] #20492: Switch submit_button()'s parameters to an associative array

WordPress Trac wp-trac at lists.automattic.com
Thu Apr 19 20:40:10 UTC 2012


#20492: Switch submit_button()'s parameters to an associative array
-------------------------+-----------------------------
 Reporter:  johnbillion  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  low          |  Milestone:  Awaiting Review
Component:  General      |    Version:  3.4
 Severity:  normal       |   Keywords:
-------------------------+-----------------------------
 The `submit_button()` function takes five arguments and calling it ends up
 being very messy.

 Example [comment:ticket:20490:3 given by Scribu]:
 > It makes for very unreadable code. For example, when I see this:
 >
 > {{{
 > submit_button( $args['label_submit'], 'button', 'submit', false, array(
 'id' => $args['id_submit'] ) )
 > }}}
 >
 > I have no idea what that `false` parameter is for, without looking up
 the defition for submit_button().
 >
 > Plus, it's not that much shorter than writing the HTML by hand, which is
 clear as day:
 >
 > {{{
 > <input name="submit" type="submit" id="<?php echo esc_attr(
 $args['id_submit'] ); ?>" value="<?php echo esc_attr(
 $args['label_submit'] ); ?>" />
 > }}}

 Let's change this so it accepts a `$text` parameter for the button text
 and an `$attributes` parameter for everything else.

 Patch coming up.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20492>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list