'table',
'div',
'raw',
+ 'inline',
);
/**
$html = Html::rawElement( 'table',
$attribs,
Html::rawElement( 'tbody', array(), "\n$html\n" ) ) . "\n";
+ } elseif ( $displayFormat === 'inline' ) {
+ $html = Html::rawElement( 'span', $attribs, "\n$html\n" );
} else {
$html = Html::rawElement( 'div', $attribs, "\n$html\n" );
}
return $this->getDiv( $value );
}
+ /**
+ * Get the complete field as an inline element.
+ * @since 1.25
+ * @param string $value The value to set the input to.
+ * @return string Complete HTML inline element
+ */
+ public function getInline( $value ) {
+ list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
+ $inputHtml = $this->getInputHTML( $value );
+ $helptext = $this->getHelpTextHtmlDiv( $this->getHelpText() );
+ $cellAttributes = array();
+ $label = $this->getLabelHtml( $cellAttributes );
+
+ $html = "\n" . $errors .
+ $label . ' ' .
+ $inputHtml .
+ $helptext;
+
+ return $html;
+ }
+
/**
* Generate help text HTML in table format
* @since 1.20
$out = $this->getOutput();
# Create the input form
- $out->addHTML(
- Html::openElement(
- 'form',
- array( 'id' => 'fileduplicatesearch', 'method' => 'get', 'action' => wfScript() )
- ) . "\n" .
- Html::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) . "\n" .
- Html::openElement( 'fieldset' ) . "\n" .
- Html::element( 'legend', null, $this->msg( 'fileduplicatesearch-legend' )->text() ) . "\n" .
- Xml::inputLabel(
- $this->msg( 'fileduplicatesearch-filename' )->text(),
- 'filename',
- 'filename',
- 50,
- $this->filename
- ) . "\n" .
- Xml::submitButton( $this->msg( 'fileduplicatesearch-submit' )->text() ) . "\n" .
- Html::closeElement( 'fieldset' ) . "\n" .
- Html::closeElement( 'form' )
+ $formFields = array(
+ 'filename' => array(
+ 'type' => 'text',
+ 'name' => 'filename',
+ 'label-message' => 'fileduplicatesearch-filename',
+ 'id' => 'filename',
+ 'size' => 50,
+ 'value' => $this->filename,
+ 'cssclass' => 'mw-ui-input-inline'
+ ),
+ );
+ $hiddenFields = array(
+ 'title' => $this->getPageTitle()->getPrefixedDBKey(),
);
+ $htmlForm = HTMLForm::factory( 'inline', $formFields, $this->getContext() );
+ $htmlForm->addHiddenFields( $hiddenFields );
+ $htmlForm->setAction( wfScript() );
+ $htmlForm->setMethod( 'get' );
+ $htmlForm->setSubmitProgressive();
+ $htmlForm->setSubmitTextMsg( $this->msg( 'fileduplicatesearch-submit' ) );
+ $htmlForm->setWrapperLegendMsg( 'fileduplicatesearch-legend' );
+
+ // The form should be visible always, even if it was submitted (e.g. to perform another action).
+ // To bypass the callback validation of HTMLForm, use prepareForm() and displayForm().
+ $htmlForm->prepareForm()->displayForm( false );
if ( $this->file ) {
$this->hash = $this->file->getSha1();