X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fhtmlform%2FHTMLFormField.php;h=7e4b15b0518e0412e9c3d63d42769bdc75e075dd;hb=2d89bdf1182df1178b9aada67a080011d29e142c;hp=0e1860bef057b939309a457a0384cf26e26e373e;hpb=2e040b99eda6c99cf472b3896f62d2f21315e808;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 0e1860bef0..7e4b15b051 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -13,6 +13,7 @@ abstract class HTMLFormField { protected $mLabel; # String label. Set on construction protected $mID; protected $mClass = ''; + protected $mHelpClass = false; protected $mDefault; protected $mOptions = false; protected $mOptionsLabelsNotFromMessage = false; @@ -34,7 +35,7 @@ abstract class HTMLFormField { * the input object itself. It should not implement the surrounding * table cells/rows, or labels/help messages. * - * @param string $value the value to set the input to; eg a default + * @param string $value The value to set the input to; eg a default * text for a text input. * * @return string Valid HTML. @@ -124,7 +125,7 @@ abstract class HTMLFormField { * * @param array $alldata * @param array $params - * @return boolean + * @return bool */ protected function isHiddenRecurse( array $alldata, array $params ) { $origParams = $params; @@ -249,7 +250,7 @@ abstract class HTMLFormField { * @param string|array $value The value the field was submitted with * @param array $alldata The data collected from the form * - * @return bool true to cancel the submission + * @return bool True to cancel the submission */ function cancelSubmit( $value, $alldata ) { return false; @@ -263,7 +264,7 @@ abstract class HTMLFormField { * @param string|array $value The value the field was submitted with * @param array $alldata The data collected from the form * - * @return bool|string true on success, or String error to display, or + * @return bool|string True on success, or String error to display, or * false to fail validation without displaying an error. */ function validate( $value, $alldata ) { @@ -397,6 +398,10 @@ abstract class HTMLFormField { $this->mClass = $params['cssclass']; } + if ( isset( $params['csshelpclass'] ) ) { + $this->mHelpClass = $params['csshelpclass']; + } + if ( isset( $params['validation-callback'] ) ) { $this->mValidationCallback = $params['validation-callback']; } @@ -504,7 +509,7 @@ abstract class HTMLFormField { ); $divCssClasses = array( "mw-htmlform-field-$fieldType", $this->mClass, $errorClass ); if ( $this->mParent->isVForm() ) { - $divCssClasses[] = 'mw-ui-vform-div'; + $divCssClasses[] = 'mw-ui-vform-field'; } $wrapperAttributes = array( @@ -562,7 +567,11 @@ abstract class HTMLFormField { $rowAttributes['class'] = 'mw-htmlform-hide-if'; } - $row = Html::rawElement( 'td', array( 'colspan' => 2, 'class' => 'htmlform-tip' ), $helptext ); + $tdClasses = array( 'htmlform-tip' ); + if ( $this->mHelpClass !== false ) { + $tdClasses[] = $this->mHelpClass; + } + $row = Html::rawElement( 'td', array( 'colspan' => 2, 'class' => $tdClasses ), $helptext ); $row = Html::rawElement( 'tr', $rowAttributes, $row ); return $row;