HTMLForm: Deprecate parameters 'notice', 'notice-messages', 'notice-message'
authorBartosz Dziewoński <matma.rex@gmail.com>
Fri, 17 Aug 2018 21:04:57 +0000 (23:04 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Wed, 29 Aug 2018 20:02:52 +0000 (22:02 +0200)
Bug: T197179
Change-Id: I603436e0720fdc0f08f35f3c0630b79865a9c82a

RELEASE-NOTES-1.32
includes/htmlform/HTMLForm.php
includes/htmlform/HTMLFormField.php

index c765fc1..7ab2134 100644 (file)
@@ -398,6 +398,10 @@ because of Phabricator reports.
   mw.user.getPageviewToken to better capture its function.
 * Passing Revision objects to ContentHandler::getUndoContent() is deprecated,
   Content object should be passed instead.
+* (T197179) Parameters 'notice', 'notice-messages', 'notice-message',
+  previously used by OOUI HTMLForm fields, are now deprecated. Use
+  'help', 'help-message', 'help-messages' instead.
+* (T197179) HTMLFormField::getNotices() is now deprecated.
 
 === Other changes in 1.32 ===
 * (T198811) The following tables have had their UNIQUE indexes turned into
index 43c9ee0..8e78459 100644 (file)
@@ -81,11 +81,9 @@ use Wikimedia\ObjectFactory;
  *    'help-inline'         -- Whether help text (defined using options above) will be shown
  *                             inline after the input field, rather than in a popup.
  *                             Defaults to true. Only used by OOUI form fields.
- *    'notice'              -- message text for a message to use as a notice in the field.
- *                             Currently used by OOUI form fields only.
- *    'notice-messages'     -- array of message keys/objects to use for notice.
- *                             Overrides 'notice'.
- *    'notice-message'      -- message key or object to use as a notice.
+ *    'notice'              -- (deprecated, use 'help' instead)
+ *    'notice-messages'     -- (deprecated, use 'help-messages' instead)
+ *    'notice-message'      -- (deprecated, use 'help-message' instead)
  *    'required'            -- passed through to the object, indicating that it
  *                             is a required field.
  *    'size'                -- the length of text fields
index f5d6e8c..bd08da0 100644 (file)
@@ -462,6 +462,16 @@ abstract class HTMLFormField {
                if ( isset( $params['hide-if'] ) ) {
                        $this->mHideIf = $params['hide-if'];
                }
+
+               if ( isset( $this->mParams['notice-message'] ) ) {
+                       wfDeprecated( "'notice-message' parameter in HTMLForm", '1.32' );
+               }
+               if ( isset( $this->mParams['notice-messages'] ) ) {
+                       wfDeprecated( "'notice-messages' parameter in HTMLForm", '1.32' );
+               }
+               if ( isset( $this->mParams['notice'] ) ) {
+                       wfDeprecated( "'notice' parameter in HTMLForm", '1.32' );
+               }
        }
 
        /**
@@ -607,7 +617,7 @@ abstract class HTMLFormField {
                        $error = new OOUI\HtmlSnippet( $error );
                }
 
-               $notices = $this->getNotices();
+               $notices = $this->getNotices( 'skip deprecation' );
                foreach ( $notices as &$notice ) {
                        $notice = new OOUI\HtmlSnippet( $notice );
                }
@@ -915,9 +925,16 @@ abstract class HTMLFormField {
         * Determine notices to display for the field.
         *
         * @since 1.28
+        * @deprecated since 1.32
+        * @param string $skipDeprecation Pass 'skip deprecation' to avoid the deprecation
+        *   warning (since 1.32)
         * @return string[]
         */
-       public function getNotices() {
+       public function getNotices( $skipDeprecation = null ) {
+               if ( $skipDeprecation !== 'skip deprecation' ) {
+                       wfDeprecated( __METHOD__, '1.32' );
+               }
+
                $notices = [];
 
                if ( isset( $this->mParams['notice-message'] ) ) {