X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fhtmlform%2FHTMLForm.php;h=296c4b3bb935ba7cc7029cc1b782bd9f75504d1f;hb=95cf21f8ee45faaa6c933b42bebae687a28849c4;hp=702c2ebc7aa52fd3e9ecd39b613f8919691af834;hpb=fb4821adfc3ab95d9c5c0be1162139f99bfebf6c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index 702c2ebc7a..296c4b3bb9 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -213,11 +213,11 @@ class HTMLForm extends ContextSource { protected $mAction = false; /** - * Form attribute autocomplete. false does not set the attribute + * Form attribute autocomplete. A typical value is "off". null does not set the attribute * @since 1.27 - * @var bool|string + * @var string|null */ - protected $mAutocomplete = false; + protected $mAutocomplete = null; protected $mUseMultipart = false; protected $mHiddenFields = []; @@ -271,7 +271,7 @@ class HTMLForm extends ContextSource { * Construct a HTMLForm object for given display type. May return a HTMLForm subclass. * * @param string $displayFormat - * @param mixed $arguments... Additional arguments to pass to the constructor. + * @param mixed $arguments,... Additional arguments to pass to the constructor. * @return HTMLForm */ public static function factory( $displayFormat/*, $arguments...*/ ) { @@ -450,7 +450,7 @@ class HTMLForm extends ContextSource { * @since 1.23 * * @param string $fieldname Name of the field - * @param array $descriptor Input Descriptor, as described above + * @param array &$descriptor Input Descriptor, as described above * * @throws MWException * @return string Name of a HTMLFormField subclass @@ -1062,7 +1062,7 @@ class HTMLForm extends ContextSource { if ( $this->mId ) { $attribs['id'] = $this->mId; } - if ( $this->mAutocomplete ) { + if ( is_string( $this->mAutocomplete ) ) { $attribs['autocomplete'] = $this->mAutocomplete; } if ( $this->mName ) { @@ -1723,6 +1723,12 @@ class HTMLForm extends ContextSource { * @return string HTML */ protected function formatSection( array $fieldsHtml, $sectionName, $anyFieldHasLabel ) { + if ( !$fieldsHtml ) { + // Do not generate any wrappers for empty sections. Sections may be empty if they only have + // subsections, but no fields. A legend will still be added in wrapFieldSetSection(). + return ''; + } + $displayFormat = $this->getDisplayFormat(); $html = implode( '', $fieldsHtml ); @@ -1862,12 +1868,12 @@ class HTMLForm extends ContextSource { } /** - * Set the value for the autocomplete attribute of the form. - * When set to false (which is the default state), the attribute get not set. + * Set the value for the autocomplete attribute of the form. A typical value is "off". + * When set to null (which is the default state), the attribute get not set. * * @since 1.27 * - * @param string|bool $autocomplete + * @param string|null $autocomplete * * @return HTMLForm $this for chaining calls */ @@ -1893,7 +1899,7 @@ class HTMLForm extends ContextSource { * 'novalidate' attribute will be added on the `
` element. It will be removed if the user * agent has JavaScript support, in htmlform.js. * - * @return boolean + * @return bool * @since 1.29 */ public function needsJSForHtml5FormValidation() {