Merge "[MCR] pass $queryFlags into RevisionStore::getTitle"
[lhc/web/wiklou.git] / includes / htmlform / HTMLForm.php
index 7293b99..296c4b3 100644 (file)
@@ -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 = [];
@@ -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 `<form>` 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() {