Do not double up on id attribute for submit_button() if id is provided in other attributes param. props duck_. see #15064

git-svn-id: http://svn.automattic.com/wordpress/trunk@16568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2010-11-24 16:30:40 +00:00
parent 43448dc471
commit 02e9501c47
1 changed files with 7 additions and 5 deletions

View File

@ -2120,6 +2120,13 @@ function get_submit_button( $text = NULL, $type = 'primary', $name = 'submit', $
endswitch;
$text = ( NULL == $text ) ? __( 'Save Changes' ) : $text;
// Default the id attribute to $name unless an id was specifically provided in $other_attributes
$id = $name;
if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) {
$id = $other_attributes['id'];
unset( $other_attributes['id'] );
}
$attributes = '';
if ( is_array( $other_attributes ) ) {
foreach ( $other_attributes as $attribute => $value ) {
@ -2129,11 +2136,6 @@ function get_submit_button( $text = NULL, $type = 'primary', $name = 'submit', $
$attributes = $other_attributes;
}
// Default the id attribute to $name unless an id was specifically provided in $other_attributes
$id = $name;
if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) )
$id = $other_attributes['id'];
$button = '<input type="submit" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class );
$button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';