From: John Du Hart Date: Sun, 23 Oct 2011 16:57:53 +0000 (+0000) Subject: Adding flatlists to HTMLRadioField, sort of like HTMLMultiSelect X-Git-Tag: 1.31.0-rc.0~26948 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=45763bd77d05bfc2c0b417813ed4a517079f00c0;p=lhc%2Fweb%2Fwiklou.git Adding flatlists to HTMLRadioField, sort of like HTMLMultiSelect --- diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 4f5b32604e..11e477b242 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -1768,6 +1768,14 @@ class HTMLSelectAndOtherField extends HTMLSelectField { * Radio checkbox fields. */ class HTMLRadioField extends HTMLFormField { + function __construct( $params ) { + parent::__construct( $params ); + if ( isset( $params['flatlist'] ) ) { + $this->mClass .= ' mw-htmlform-radio-flatlist'; + } + } + + function validate( $value, $alldata ) { $p = parent::validate( $value, $alldata ); @@ -1815,16 +1823,16 @@ class HTMLRadioField extends HTMLFormField { $html .= $this->formatOptions( $info, $value ); } else { $id = Sanitizer::escapeId( $this->mID . "-$info" ); - $html .= Xml::radio( + $radio = Xml::radio( $this->mName, $info, $info == $value, $attribs + array( 'id' => $id ) ); - $html .= ' ' . + $radio .= ' ' . Html::rawElement( 'label', array( 'for' => $id ), $label ); - $html .= "
\n"; + $html .= ' ' . Html::rawElement( 'div', array( 'class' => 'mw-htmlform-radio-item' ), $radio ); } } diff --git a/skins/common/shared.css b/skins/common/shared.css index 695c6e599a..002444dff8 100644 --- a/skins/common/shared.css +++ b/skins/common/shared.css @@ -259,6 +259,7 @@ tr.mw-htmlform-vertical-label td.mw-label { .mw-htmlform-invalid-input td.mw-input input { border-color: red; } +.mw-htmlform-radio-flatlist div.mw-htmlform-radio-item, .mw-htmlform-multiselect-flatlist div.mw-htmlform-multiselect-item { display: inline; margin-right: 1em;