jenkins-bot has submitted this change and it was merged.

Change subject: ButtonWidget: Rename nofollow config option to noFollow
......................................................................


ButtonWidget: Rename nofollow config option to noFollow

Use consistent camel case.  The old `nofollow` property still works,
for backward compatibility, but it is deprecated and will be removed
in the next major release (T89767).

Change-Id: I30eb9683e120224b3182e2da23e04b66c135e05a
---
M php/widgets/ButtonWidget.php
M src/widgets/ButtonWidget.js
2 files changed, 24 insertions(+), 19 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/php/widgets/ButtonWidget.php b/php/widgets/ButtonWidget.php
index b387eb4..934aaab 100644
--- a/php/widgets/ButtonWidget.php
+++ b/php/widgets/ButtonWidget.php
@@ -28,13 +28,13 @@
         *
         * @var boolean
         */
-       protected $nofollow = true;
+       protected $noFollow = true;
 
        /**
         * @param array $config Configuration options
         * @param string $config['href'] Hyperlink to visit when clicked
         * @param string $config['target'] Target to open hyperlink in
-        * @param boolean $config['nofollow'] Search engine traversal hint 
(default: true)
+        * @param boolean $config['noFollow'] Search engine traversal hint 
(default: true)
         */
        public function __construct( array $config = array() ) {
                // Parent constructor
@@ -59,7 +59,11 @@
 
                $this->setHref( isset( $config['href'] ) ? $config['href'] : 
null );
                $this->setTarget( isset( $config['target'] ) ? 
$config['target'] : null );
-               $this->setNoFollow( isset( $config['nofollow'] ) ? 
$config['nofollow'] : true );
+               $this->setNoFollow( isset( $config['noFollow'] ) ? 
$config['noFollow'] : true );
+               // FIXME: The `nofollow` alias is deprecated and will be 
removed (T89767)
+               if ( isset( $config['nofollow'] ) ) {
+                       $this->setNoFollow( $config['nofollow'] );
+               }
        }
 
        /**
@@ -86,7 +90,7 @@
         * @return boolean Whether search engines should avoid traversing this 
hyperlink.
         */
        public function getNoFollow() {
-               return $this->nofollow;
+               return $this->noFollow;
        }
 
        /**
@@ -126,12 +130,12 @@
        /**
         * Set search engine traversal hint.
         *
-        * @param boolean $nofollow True if search engines should avoid 
traversing this hyperlink
+        * @param boolean $noFollow True if search engines should avoid 
traversing this hyperlink
         */
-       public function setNoFollow( $nofollow ) {
-               $this->nofollow = is_bool( $nofollow ) ? $nofollow : true;
+       public function setNoFollow( $noFollow ) {
+               $this->noFollow = is_bool( $noFollow ) ? $noFollow : true;
 
-               if ( $this->nofollow ) {
+               if ( $this->noFollow ) {
                        $this->button->setAttributes( array( 'rel' => 
'nofollow' ) );
                } else {
                        $this->button->removeAttributes( array( 'rel' ) );
diff --git a/src/widgets/ButtonWidget.js b/src/widgets/ButtonWidget.js
index 0ae2c89..2e07f64 100644
--- a/src/widgets/ButtonWidget.js
+++ b/src/widgets/ButtonWidget.js
@@ -20,11 +20,12 @@
  * @param {Object} [config] Configuration options
  * @cfg {string} [href] Hyperlink to visit when clicked
  * @cfg {string} [target] Target to open hyperlink in
- * @cfg {boolean} [nofollow] Search engine traversal hint (default: true)
+ * @cfg {boolean} [noFollow] Search engine traversal hint (default: true)
  */
 OO.ui.ButtonWidget = function OoUiButtonWidget( config ) {
        // Configuration initialization
-       config = config || {};
+       // FIXME: The `nofollow` alias is deprecated and will be removed 
(T89767)
+       config = $.extend( { noFollow: config && config.nofollow }, config );
 
        // Parent constructor
        OO.ui.ButtonWidget.super.call( this, config );
@@ -41,7 +42,7 @@
        // Properties
        this.href = null;
        this.target = null;
-       this.nofollow = false;
+       this.noFollow = false;
        this.isHyperlink = false;
 
        // Initialization
@@ -51,7 +52,7 @@
                .append( this.$button );
        this.setHref( config.href );
        this.setTarget( config.target );
-       this.setNoFollow( config.nofollow );
+       this.setNoFollow( config.noFollow );
 };
 
 /* Setup */
@@ -137,7 +138,7 @@
  * @return {boolean} Whether search engines should avoid traversing this 
hyperlink
  */
 OO.ui.ButtonWidget.prototype.getNoFollow = function () {
-       return this.nofollow;
+       return this.noFollow;
 };
 
 /**
@@ -185,14 +186,14 @@
 /**
  * Set search engine traversal hint.
  *
- * @param {boolean} nofollow True if search engines should avoid traversing 
this hyperlink
+ * @param {boolean} noFollow True if search engines should avoid traversing 
this hyperlink
  */
-OO.ui.ButtonWidget.prototype.setNoFollow = function ( nofollow ) {
-       nofollow = typeof nofollow === 'boolean' ? nofollow : true;
+OO.ui.ButtonWidget.prototype.setNoFollow = function ( noFollow ) {
+       noFollow = typeof noFollow === 'boolean' ? noFollow : true;
 
-       if ( nofollow !== this.nofollow ) {
-               this.nofollow = nofollow;
-               if ( nofollow ) {
+       if ( noFollow !== this.noFollow ) {
+               this.noFollow = noFollow;
+               if ( noFollow ) {
                        this.$button.attr( 'rel', 'nofollow' );
                } else {
                        this.$button.removeAttr( 'rel' );

-- 
To view, visit https://gerrit.wikimedia.org/r/190514
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I30eb9683e120224b3182e2da23e04b66c135e05a
Gerrit-PatchSet: 6
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
Gerrit-Reviewer: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to