X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fhtmlform%2FHTMLFormField.php;h=2e3fdb0ccf99ae99dd1af840dd466c6049c8ab73;hb=cb2896f90ebef77c02c9da4067b0e56e37471092;hp=13756e3d648cfca39849a8ea25e2ebbf025d0c9b;hpb=09f4a785b33c346f668067b526594ccbc73b8bf0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 13756e3d64..2e3fdb0ccf 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -11,7 +11,7 @@ abstract class HTMLFormField { protected $mFilterCallback; protected $mName; protected $mDir; - protected $mLabel; # String label. Set on construction + protected $mLabel; # String label, as HTML. Set on construction. protected $mID; protected $mClass = ''; protected $mVFormClass = ''; @@ -55,6 +55,15 @@ abstract class HTMLFormField { return false; } + /** + * True if this field type is able to display errors; false if validation errors need to be + * displayed in the main HTMLForm error area. + * @return bool + */ + public function canDisplayErrors() { + return true; + } + /** * Get a translated interface message * @@ -592,7 +601,7 @@ abstract class HTMLFormField { $config = array( 'classes' => array( "mw-htmlform-field-$fieldType", $this->mClass ), 'align' => $this->getLabelAlignOOUI(), - 'label' => $this->getLabel(), + 'label' => new OOUI\HtmlSnippet( $this->getLabel() ), 'help' => $helpText !== null ? new OOUI\HtmlSnippet( $helpText ) : null, 'errors' => $errors, 'infusable' => $infusable, @@ -828,7 +837,7 @@ abstract class HTMLFormField { } /** - * @return string + * @return string HTML */ function getLabel() { return is_null( $this->mLabel ) ? '' : $this->mLabel; @@ -916,7 +925,8 @@ abstract class HTMLFormField { * Returns the given attributes from the parameters * * @param array $list List of attributes to get - * @param array $mappings Optional - Key/value map of attribute names to use instead of the ones passed in + * @param array $mappings Optional - Key/value map of attribute names to use + * instead of the ones passed in. * @return array Attributes */ public function getAttributes( array $list, array $mappings = null ) {