X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FHtml.php;h=235096dddecda63d60ca783fa7ae01954dad45c7;hb=f773b2419ba3e8587edf4980de39e14f70a7c783;hp=6907245bc35e2f962394e92fbdfb070fb2d21052;hpb=786a37c5778e2fc69b48010236199621449ebba0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Html.php b/includes/Html.php index 6907245bc3..235096ddde 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -104,8 +104,8 @@ class Html { /** * Modifies a set of attributes meant for button elements * and apply a set of default attributes when $wgUseMediaWikiUIEverywhere enabled. - * @param array $attrs - * @param string[] $modifiers to add to the button + * @param array $attrs HTML attributes in an associative array + * @param string[] $modifiers classes to add to the button * @see https://tools.wmflabs.org/styleguide/desktop/index.html for guidance on available modifiers * @return array $attrs A modified attribute array */ @@ -115,16 +115,15 @@ class Html { if ( isset( $attrs['class'] ) ) { if ( is_array( $attrs['class'] ) ) { $attrs['class'][] = 'mw-ui-button'; - $attrs = array_merge( $attrs, $modifiers ); + $attrs['class'] = array_merge( $attrs['class'], $modifiers ); // ensure compatibility with Xml $attrs['class'] = implode( ' ', $attrs['class'] ); } else { $attrs['class'] .= ' mw-ui-button ' . implode( ' ', $modifiers ); } } else { - $attrs['class'] = array( 'mw-ui-button' ); // ensure compatibility with Xml - $attrs['class'] = implode( ' ', array_merge( $attrs['class'], $modifiers ) ); + $attrs['class'] = 'mw-ui-button ' . implode( ' ', $modifiers ); } } return $attrs; @@ -162,7 +161,7 @@ class Html { * @param array $attrs Associative array of attributes, e.g., array( * 'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for * further documentation. - * @param string[] $modifiers to add to the button + * @param string[] $modifiers classes to add to the button * @see http://tools.wmflabs.org/styleguide/desktop/index.html for guidance on available modifiers * @return string Raw HTML */ @@ -182,7 +181,7 @@ class Html { * @param array $attrs Associative array of attributes, e.g., array( * 'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for * further documentation. - * @param string[] $modifiers to add to the button + * @param string[] $modifiers classes to add to the button * @see http://tools.wmflabs.org/styleguide/desktop/index.html for guidance on available modifiers * @return string Raw HTML */ @@ -716,6 +715,9 @@ class Html { if ( in_array( $type, array( 'text', 'search', 'email', 'password', 'number' ) ) ) { $attribs = self::getTextInputAttributes( $attribs ); } + if ( in_array( $type, array( 'button', 'reset', 'submit' ) ) ) { + $attribs = self::buttonAttributes( $attribs ); + } return self::element( 'input', $attribs ); }