From: Derric Atzrott Date: Wed, 16 Jul 2014 13:38:37 +0000 (-0400) Subject: Adding css styling option for help option in HTMLForm X-Git-Tag: 1.31.0-rc.0~14915^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=0cda6a5182ac9ee9ed5c696de5d65a6f3c8ff332;p=lhc%2Fweb%2Fwiklou.git Adding css styling option for help option in HTMLForm There is now a new option named csshelpclass that can be passed in form descriptors for HTMLForm objects. This option accepts a css class and applies it to the help text that is provided with the help option in the form descriptor. Bug: 65087 Change-Id: If1bd1d12a9159895f45c9cf0fbb7992e4c7e3526 --- diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index 33346948e2..df6582c7b2 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -50,6 +50,7 @@ * 'default' -- default value when the form is displayed * 'id' -- HTML id attribute * 'cssclass' -- CSS class + * 'csshelpclass' -- CSS class used to style help text * 'options' -- associative array mapping labels to values. * Some field types support multi-level arrays. * 'options-messages' -- associative array mapping message keys to values. diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 8076e8ad24..1fcc8661cb 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; @@ -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']; } @@ -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;