X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fhtmlform%2FHTMLForm.php;h=d50fac0a695af20143e1cc4a0467da829018d9d6;hb=052d2ba86aa56209e060f882bd6c250f74920549;hp=ba432442f99a74bc272e86a1446f4ed86acdbbb7;hpb=fb7b3eebeb8de47eb42e8d6ccf204106a2d6d9e4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index ba432442f9..d50fac0a69 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -56,19 +56,19 @@ * Some field types support multi-level arrays. * 'options-messages' -- associative array mapping message keys to values. * Some field types support multi-level arrays. - * 'options-message' -- message key to be parsed to extract the list of + * 'options-message' -- message key or object to be parsed to extract the list of * options (like 'ipbreason-dropdown'). - * 'label-message' -- message key for a message to use as the label. + * 'label-message' -- message key or object for a message to use as the label. * can be an array of msg key and then parameters to * the message. * 'label' -- alternatively, a raw text message. Overridden by * label-message * 'help' -- message text for a message to use as a help text. - * 'help-message' -- message key for a message to use as a help text. + * 'help-message' -- message key or object for a message to use as a help text. * can be an array of msg key and then parameters to * the message. * Overwrites 'help-messages' and 'help'. - * 'help-messages' -- array of message key. As above, each item can + * 'help-messages' -- array of message keys/objects. As above, each item can * be an array of msg key and then parameters. * Overwrites 'help'. * 'required' -- passed through to the object, indicating that it @@ -180,6 +180,7 @@ class HTMLForm extends ContextSource { protected $mSectionFooters = []; protected $mPost = ''; protected $mId; + protected $mName; protected $mTableId = ''; protected $mSubmitID; @@ -198,6 +199,13 @@ class HTMLForm extends ContextSource { */ protected $mAction = false; + /** + * Form attribute autocomplete. false does not set the attribute + * @since 1.27 + * @var bool|string + */ + protected $mAutocomplete = false; + protected $mUseMultipart = false; protected $mHiddenFields = []; protected $mButtons = []; @@ -996,6 +1004,12 @@ class HTMLForm extends ContextSource { if ( !empty( $this->mId ) ) { $attribs['id'] = $this->mId; } + if ( !empty( $this->mAutocomplete ) ) { + $attribs['autocomplete'] = $this->mAutocomplete; + } + if ( !empty ( $this->mName ) ) { + $attribs['name'] = $this->mName; + } return $attribs; } @@ -1337,6 +1351,16 @@ class HTMLForm extends ContextSource { return $this; } + /** + * @param string $name 'name' attribute for the form + * @return HTMLForm $this for chaining calls + */ + public function setName( $name ) { + $this->mName = $name; + + return $this; + } + /** * Prompt the whole form to be wrapped in a "
", with * this text as its "" element. @@ -1677,4 +1701,20 @@ class HTMLForm extends ContextSource { return $this->getTitle()->getLocalURL(); } + + /** + * Set the value for the autocomplete attribute of the form. + * When set to false (which is the default state), the attribute get not set. + * + * @since 1.27 + * + * @param string|bool $autocomplete + * + * @return HTMLForm $this for chaining calls + */ + public function setAutocomplete( $autocomplete ) { + $this->mAutocomplete = $autocomplete; + + return $this; + } }