protected $uniqueId;
public function __construct( $params ) {
- $this->uniqueId = get_class( $this ) . ++self::$counter . 'x';
+ $this->uniqueId = static::class . ++self::$counter . 'x';
parent::__construct( $params );
if ( empty( $this->mParams['fields'] ) || !is_array( $this->mParams['fields'] ) ) {
if ( isset( $this->mParams['fields']['delete'] ) ) {
$class = 'mw-htmlform-cloner-delete-button';
$info = $this->mParams['fields']['delete'] + [
+ 'formnovalidate' => true,
'cssclass' => $class
];
unset( $info['name'], $info['class'] );
$info['name'] = $name;
}
if ( isset( $info['id'] ) ) {
- $info['id'] = Sanitizer::escapeId( "{$this->mID}--$key--{$info['id']}" );
+ $info['id'] = Sanitizer::escapeIdForAttribute( "{$this->mID}--$key--{$info['id']}" );
} else {
- $info['id'] = Sanitizer::escapeId( "{$this->mID}--$key--$fieldname" );
+ $info['id'] = Sanitizer::escapeIdForAttribute( "{$this->mID}--$key--$fieldname" );
}
// Copy the hide-if rules to "child" fields, so that the JavaScript code handling them
// (resources/src/mediawiki/htmlform/hide-if.js) doesn't have to handle nested fields.
: 'htmlform-cloner-delete';
$field = HTMLForm::loadInputFromParameters( $name, [
'type' => 'submit',
+ 'formnovalidate' => true,
'name' => $name,
- 'id' => Sanitizer::escapeId( "{$this->mID}--$key--delete" ),
+ 'id' => Sanitizer::escapeIdForAttribute( "{$this->mID}--$key--delete" ),
'cssclass' => 'mw-htmlform-cloner-delete-button',
'default' => $this->getMessage( $label )->text(),
], $this->mParent );
: 'htmlform-cloner-create';
$field = HTMLForm::loadInputFromParameters( $name, [
'type' => 'submit',
+ 'formnovalidate' => true,
'name' => $name,
- 'id' => Sanitizer::escapeId( "{$this->mID}--create" ),
+ 'id' => Sanitizer::escapeIdForAttribute( "{$this->mID}--create" ),
'cssclass' => 'mw-htmlform-cloner-create-button',
'default' => $this->getMessage( $label )->text(),
], $this->mParent );