return $this;
}
+ /**
+ * Get header text.
+ *
+ * @param string|null $section The section to get the header text for
+ * @since 1.26
+ * @return string
+ */
+ function getHeaderText( $section = null ) {
+ if ( is_null( $section ) ) {
+ return $this->mHeader;
+ } else {
+ return isset( $this->mSectionHeaders[$section] ) ? $this->mSectionHeaders[$section] : '';
+ }
+ }
+
/**
* Add footer text, inside the form.
*
return $this;
}
+ /**
+ * Get footer text.
+ *
+ * @param string|null $section The section to get the footer text for
+ * @since 1.26
+ * @return string
+ */
+ function getFooterText( $section = null ) {
+ if ( is_null( $section ) ) {
+ return $this->mFooter;
+ } else {
+ return isset( $this->mSectionFooters[$section] ) ? $this->mSectionFooters[$section] : '';
+ }
+ }
+
/**
* Add text to the end of the display.
*
$html = ''
. $this->getErrors( $submitResult )
- // In OOUI forms, we handle mHeader elsewhere. FIXME This is horrible.
- . ( $this->getDisplayFormat() === 'ooui' ? '' : $this->mHeader )
+ . $this->getHeaderText()
. $this->getBody()
. $this->getHiddenFields()
. $this->getButtons()
- . $this->mFooter;
+ . $this->getFooterText();
$html = $this->wrapForm( $html );
$legend = $this->getLegend( $key );
- if ( isset( $this->mSectionHeaders[$key] ) ) {
- $section = $this->mSectionHeaders[$key] . $section;
- }
- if ( isset( $this->mSectionFooters[$key] ) ) {
- $section .= $this->mSectionFooters[$key];
- }
+ $section = $this->getHeaderText( $key ) .
+ $section .
+ $this->getFooterText( $key );
$attributes = array();
if ( $fieldsetIDPrefix ) {
return '';
}
+ function getHeaderText( $section = null ) {
+ if ( is_null( $section ) ) {
+ // We handle $this->mHeader elsewhere, in getBody()
+ return '';
+ } else {
+ return parent::getHeaderText( $section );
+ }
+ }
+
function getBody() {
$fieldset = parent::getBody();
// FIXME This only works for forms with no subsections