[wp-trac] [WordPress Trac] #15064: Template function for wp-admin submit buttons

WordPress Trac wp-trac at lists.automattic.com
Wed Oct 27 07:34:37 UTC 2010


#15064: Template function for wp-admin submit buttons
----------------------------+-----------------------------------------------
 Reporter:  markjaquith     |       Owner:           
     Type:  enhancement     |      Status:  new      
 Priority:  normal          |   Milestone:  3.1      
Component:  Administration  |     Version:           
 Severity:  normal          |    Keywords:  has-patch
----------------------------+-----------------------------------------------

Comment(by sbressler):

 Whew, all occurrences I could find of submit inputs should now be replaced
 with this new method.

 I changed the API of the method a bit with this patch. I added two
 parameters:

 - $wrap: Specified whether the button should be wrapped in a paragraph
 tag. True by default.[[BR]]

 - $other_attributes: Additional attributes that should be added to the
 submit button, such as accesskey, tabindex, style, id, etc. I'm supporting
 these attributes being specified in two different ways: either as array(
 'tabindex' => '2', 'id' => 'my_id' ) or 'tabindex="2" id="my_id" (props to
 Nacin for the array idea). I think the array specification looks cleaner,
 but still allow a straight string specification so that methods like
 disabled() can be used.

 Hopefully my method docs makes this easy to follow.

 I am adding an id automatically (set to the param $name) unless another id
 is specifically specified in $other_attributes (given in array format).

 Going through core, $wrap was set to false '''way''' more times than true.
 I didn't want to change the default behavior just yet without Mark's (or
 someone else's) input, but I certainly would recommend changing the
 default behavior ''not'' to wrap.

 The only occurrence of a submit button that I was unable to change to use
 this new method was in admin-bar-class.php since it seemingly
 [http://core.trac.wordpress.org/browser/trunk/wp-includes/admin-bar/admin-
 bar-class.php#L88 uses an HTML5 button].

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


More information about the wp-trac mailing list