Yaron Koren has submitted this change and it was merged.

Change subject: Added 'tooltip' param to #autoedit
......................................................................


Added 'tooltip' param to #autoedit

Based on a patch by Clubfan22

Change-Id: I6aeaa7485d27b3ad4f8fa863b433d1dd0fb40fe9
---
M includes/SF_ParserFunctions.php
1 file changed, 11 insertions(+), 2 deletions(-)

Approvals:
  Yaron Koren: Checked; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/SF_ParserFunctions.php b/includes/SF_ParserFunctions.php
index 5d5179d..7380b52 100644
--- a/includes/SF_ParserFunctions.php
+++ b/includes/SF_ParserFunctions.php
@@ -132,7 +132,8 @@
  *
  * '#autoedit' is called as:
  *
- * {{#autoedit:form=|target=|link text=|link type=|query string=|reload}}
+ * {{#autoedit:form=|target=|link text=|link type=|tooltip=|query string=
+ * |reload}}
  *
  * This function creates a link or button that, when clicked on,
  * automatically modifies the specified page according to the values in the
@@ -480,6 +481,7 @@
                $linkType = 'span';
                $summary = null;
                $classString = 'autoedit-trigger';
+               $inTooltip = null;
                $inQueryArr = array();
                $editTime = null;
 
@@ -522,6 +524,9 @@
                                        // do not parse ok text or error text 
yet. Will be parsed on api call
                                        $arr = array( $key => $value );
                                        $inQueryArr = 
SFUtils::array_merge_recursive_distinct( $inQueryArr, $arr );
+                                       break;
+                               case 'tooltip':
+                                       $inTooltip = 
Sanitizer::decodeCharReferences( $value );
                                        break;
 
                                case 'target':
@@ -568,7 +573,11 @@
                        // do not use Html::rawElement() for buttons!
                        $linkElement = '<button ' . Html::expandAttributes( 
array( 'type' => 'submit', 'class' => $classString ) ) . '>' . $linkString . 
'</button>';
                } elseif ( $linkType == 'link' ) {
-                       $linkElement = Html::rawElement( 'a', array( 'class' => 
$classString, 'href' => "#" ), $linkString );
+                       $attrs = array( 'class' => $classString, 'href' => "#" 
);
+                       if ( $inTooltip != null ) {
+                               $attrs['title'] = $inTooltip;
+                       }
+                       $linkElement = Html::rawElement( 'a', $attrs, 
$linkString );
                } else {
                        $linkElement = Html::rawElement( 'span', array( 'class' 
=> $classString ), $linkString );
                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6aeaa7485d27b3ad4f8fa863b433d1dd0fb40fe9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to