Adding functions to HTMLForm for explicitly setting the content of the header and...
authorJohn Du Hart <johnduhart@users.mediawiki.org>
Sun, 23 Oct 2011 18:38:22 +0000 (18:38 +0000)
committerJohn Du Hart <johnduhart@users.mediawiki.org>
Sun, 23 Oct 2011 18:38:22 +0000 (18:38 +0000)
Also adds a function for setting the intro, as a counterpart to addPreText

includes/HTMLForm.php

index f97519c..b80f0d7 100644 (file)
@@ -309,7 +309,16 @@ class HTMLForm extends ContextSource {
         * Set the introductory message, overwriting any existing message.
         * @param $msg String complete text of message to display
         */
-       function setIntro( $msg ) { $this->mPre = $msg; }
+       function setIntro( $msg ) {
+               $this->setPreText( $msg );
+       }
+
+       /**
+        * Set the introductory message, overwriting any existing message.
+        * @since 1.19
+        * @param $msg String complete text of message to display
+        */
+       function setPreText( $msg ) { $this->mPre = $msg; }
 
        /**
         * Add introductory text.
@@ -333,6 +342,20 @@ class HTMLForm extends ContextSource {
                }
        }
 
+       /**
+        * Set header text, inside the form.
+        * @since 1.19
+        * @param $msg String complete text of message to display
+        * @param $section The section to add the header to
+        */
+       function setHeaderText( $msg, $section = null ) {
+               if ( is_null( $section ) ) {
+                       $this->mHeader = $msg;
+               } else {
+                       $this->mSectionHeaders[$section] = $msg;
+               }
+       }
+
        /**
         * Add footer text, inside the form.
         * @param $msg String complete text of message to display
@@ -349,12 +372,32 @@ class HTMLForm extends ContextSource {
                }
        }
 
+       /**
+        * Set footer text, inside the form.
+        * @since 1.19
+        * @param $msg String complete text of message to display
+        * @param $section string The section to add the footer text to
+        */
+       function setFooterText( $msg, $section = null ) {
+               if ( is_null( $section ) ) {
+                       $this->mFooter = $msg;
+               } else {
+                       $this->mSectionFooters[$section] = $msg;
+               }
+       }
+
        /**
         * Add text to the end of the display.
         * @param $msg String complete text of message to display
         */
        function addPostText( $msg ) { $this->mPost .= $msg; }
 
+       /**
+        * Set text at the end of the display.
+        * @param $msg String complete text of message to display
+        */
+       function setPostText( $msg ) { $this->mPost = $msg; }
+
        /**
         * Add a hidden field to the output
         * @param $name String field name.  This will be used exactly as entered