* if 'class' is not specified, this is used as a map
* through HTMLForm::$typeMappings to get the class name.
* 'default' -- default value when the form is displayed
+ * 'nodata' -- if set (to any value, which casts to true), the data
+ * for this field will not be loaded from the actual request. Instead,
+ * always the default data is set as the value of this field.
* 'id' -- HTML id attribute
* 'cssclass' -- CSS class
* 'csshelpclass' -- CSS class used to style help text
'date' => HTMLDateTimeField::class,
'time' => HTMLDateTimeField::class,
'datetime' => HTMLDateTimeField::class,
+ 'expiry' => HTMLExpiryField::class,
// HTMLTextField will output the correct type="" attribute automagically.
// There are about four zillion other HTML5 input types, like range, but
// we don't use those at the moment, so no point in adding all of them.
$this->mFlatFields = [];
foreach ( $descriptor as $fieldname => $info ) {
- $section = isset( $info['section'] )
- ? $info['section']
- : '';
+ $section = $info['section'] ?? '';
if ( isset( $info['type'] ) && $info['type'] === 'file' ) {
$this->mUseMultipart = true;
if ( $section === null ) {
return $this->mHeader;
} else {
- return isset( $this->mSectionHeaders[$section] ) ? $this->mSectionHeaders[$section] : '';
+ return $this->mSectionHeaders[$section] ?? '';
}
}
if ( $section === null ) {
return $this->mFooter;
} else {
- return isset( $this->mSectionFooters[$section] ) ? $this->mSectionFooters[$section] : '';
+ return $this->mSectionFooters[$section] ?? '';
}
}
$data = [
'name' => $args[0],
'value' => $args[1],
- 'id' => isset( $args[2] ) ? $args[2] : null,
- 'attribs' => isset( $args[3] ) ? $args[3] : null,
+ 'id' => $args[2] ?? null,
+ 'attribs' => $args[3] ?? null,
];
} else {
if ( !isset( $data['name'] ) ) {
/**
* Identify that the submit button in the form has a progressive action
* @since 1.25
+ * @deprecated since 1.32, No need to call. Submit button already
+ * has a progressive action form.
*
* @return HTMLForm $this for chaining calls (since 1.28)
*/
public function setSubmitProgressive() {
+ wfDeprecated( __METHOD__, '1.32' );
$this->mSubmitFlags = [ 'progressive', 'primary' ];
return $this;
* @param string $legend Legend text for the fieldset
* @param string $section The section content in plain Html
* @param array $attributes Additional attributes for the fieldset
+ * @param bool $isRoot Section is at the root of the tree
* @return string The fieldset's Html
*/
- protected function wrapFieldSetSection( $legend, $section, $attributes ) {
+ protected function wrapFieldSetSection( $legend, $section, $attributes, $isRoot ) {
return Xml::fieldset( $legend, $section, $attributes ) . "\n";
}
if ( $fieldsetIDPrefix ) {
$attributes['id'] = Sanitizer::escapeIdForAttribute( "$fieldsetIDPrefix$key" );
}
- $subsectionHtml .= $this->wrapFieldSetSection( $legend, $section, $attributes );
+ $subsectionHtml .= $this->wrapFieldSetSection(
+ $legend, $section, $attributes, $fields === $this->mFieldTree
+ );
} else {
// Just return the inputs, nothing fancy.
$subsectionHtml .= $section;