Merge "Display an error message when the validataion of a radio input fails because...
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 11 Sep 2016 23:56:41 +0000 (23:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 11 Sep 2016 23:56:41 +0000 (23:56 +0000)
1  2 
includes/htmlform/fields/HTMLRadioField.php

@@@ -4,21 -4,6 +4,21 @@@
   * Radio checkbox fields.
   */
  class HTMLRadioField extends HTMLFormField {
 +      /**
 +       * @param array $params
 +       *   In adition to the usual HTMLFormField parameters, this can take the following fields:
 +       *   - flatlist: If given, the options will be displayed on a single line (wrapping to following
 +       *     lines if necessary), rather than each one on a line of its own. This is desirable mostly
 +       *     for very short lists of concisely labelled options.
 +       */
 +      public function __construct( $params ) {
 +              parent::__construct( $params );
 +
 +              if ( isset( $params['flatlist'] ) ) {
 +                      $this->mClass .= ' mw-htmlform-flatlist';
 +              }
 +      }
 +
        function validate( $value, $alldata ) {
                $p = parent::validate( $value, $alldata );
  
@@@ -27,7 -12,7 +27,7 @@@
                }
  
                if ( !is_string( $value ) && !is_int( $value ) ) {
-                       return false;
+                       return $this->msg( 'htmlform-required' )->parse();
                }
  
                $validOptions = HTMLFormField::flattenOptions( $this->getOptions() );
                ) );
        }
  
 +      protected function shouldInfuseOOUI() {
 +              return true;
 +      }
 +
        function formatOptions( $options, $value ) {
                global $wgUseMediaWikiUIEverywhere;