* Construct a HTMLForm object for given display type. May return a HTMLForm subclass.
*
* @param string $displayFormat
- * @param mixed $arguments... Additional arguments to pass to the constructor.
+ * @param mixed $arguments,... Additional arguments to pass to the constructor.
* @return HTMLForm
*/
public static function factory( $displayFormat/*, $arguments...*/ ) {
return ObjectFactory::constructClassInstance( OOUIHTMLForm::class, $arguments );
default:
/** @var HTMLForm $form */
- $form = ObjectFactory::constructClassInstance( HTMLForm::class, $arguments );
+ $form = ObjectFactory::constructClassInstance( self::class, $arguments );
$form->setDisplayFormat( $displayFormat );
return $form;
}
if ( !in_array( $format, $this->availableDisplayFormats, true ) ) {
throw new MWException( 'Display format must be one of ' .
- print_r( $this->availableDisplayFormats, true ) );
+ print_r(
+ array_merge(
+ $this->availableDisplayFormats,
+ $this->availableSubclassDisplayFormats
+ ),
+ true
+ ) );
}
// Evil hack for mobile :(
* @since 1.23
*
* @param string $fieldname Name of the field
- * @param array $descriptor Input Descriptor, as described above
+ * @param array &$descriptor Input Descriptor, as described above
*
* @throws MWException
* @return string Name of a HTMLFormField subclass
*
* @param string|array|Status $elements The set of errors/warnings to process.
* @param string $elementsType Should warnings or errors be returned. This is meant
- * for Status objects, all other valid types are always considered as errors.
+ * for Status objects, all other valid types are always considered as errors.
* @return string
*/
public function getErrorsOrWarnings( $elements, $elementsType ) {
$attributes = [];
if ( $fieldsetIDPrefix ) {
- $attributes['id'] = Sanitizer::escapeId( "$fieldsetIDPrefix$key" );
+ $attributes['id'] = Sanitizer::escapeIdForAttribute( "$fieldsetIDPrefix$key" );
}
$subsectionHtml .= $this->wrapFieldSetSection( $legend, $section, $attributes );
} else {
];
if ( $sectionName ) {
- $attribs['id'] = Sanitizer::escapeId( $sectionName );
+ $attribs['id'] = Sanitizer::escapeIdForAttribute( $sectionName );
}
if ( $displayFormat === 'table' ) {