Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | * |
43 | 43 | * 'formlink' is called as: |
44 | 44 | * |
45 | | - * {{#formlink:form=|link text=|link type=|query string=}} |
| 45 | + * {{#formlink:form=|link text=|link type=|title=|query string=|target=}} |
46 | 46 | * |
47 | 47 | * This function returns HTML representing a link to a form; given that |
48 | 48 | * no page name is entered by the the user, the form must be one that |
— | — | @@ -53,9 +53,12 @@ |
54 | 54 | * the link: if set to 'button', the link will be a button; if set to |
55 | 55 | * 'post button', the link will be a button that uses the 'POST' method to |
56 | 56 | * send other values to the form; if set to anything else or not called, it |
57 | | - * will be a standard hyperlink. 'query string' is the text to be added to |
58 | | - * the generated URL's query string (or, in the case of 'post button' to |
59 | | - * be sent as hidden inputs). |
| 57 | + * will be a standard hyperlink. 'title' sets the 'title' HTML attribute |
| 58 | + * for the link, if it's an actual link; i.e., the hovering tooltip text. |
| 59 | + * 'query string' is the text to be added to the generated URL's query |
| 60 | + * string (or, in the case of 'post button' to be sent as hidden inputs). |
| 61 | + * 'target' is an optional value, setting the name of the page to be |
| 62 | + * edited by the form. |
60 | 63 | * |
61 | 64 | * Example: to create a link to add data with a form called |
62 | 65 | * 'User' within a namespace also called 'User', and to have the form |
— | — | @@ -155,9 +158,10 @@ |
156 | 159 | global $wgVersion; |
157 | 160 | |
158 | 161 | $params = func_get_args(); |
159 | | - array_shift( $params ); // don't need the parser |
160 | | - // set defaults |
161 | | - $inFormName = $inLinkStr = $inLinkType = $inQueryStr = $inTargetName = ''; |
| 162 | + array_shift( $params ); // We don't need the parser. |
| 163 | + // Set defaults. |
| 164 | + $inFormName = $inLinkStr = $inLinkType = $inTitle = |
| 165 | + $inQueryStr = $inTargetName = ''; |
162 | 166 | $classStr = ""; |
163 | 167 | // assign params - support unlabelled params, for backwards compatibility |
164 | 168 | foreach ( $params as $i => $param ) { |
— | — | @@ -176,6 +180,8 @@ |
177 | 181 | $inLinkType = $value; |
178 | 182 | } elseif ( $param_name == 'query string' ) { |
179 | 183 | $inQueryStr = $value; |
| 184 | + } elseif ( $param_name == 'title' ) { |
| 185 | + $inTitle = $value; |
180 | 186 | } elseif ( $param_name == 'target' ) { |
181 | 187 | $inTargetName = $value; |
182 | 188 | } elseif ( $param_name == null && $value == 'popup' |
— | — | @@ -245,7 +251,7 @@ |
246 | 252 | $classStr .= " new"; |
247 | 253 | } |
248 | 254 | } |
249 | | - $str = "<a href=\"$link_url\" class=\"$classStr\">$inLinkStr</a>"; |
| 255 | + $str = Xml::element( 'a', array( 'href' => $link_url, 'class' => $classStr, 'title' => $inTitle ), $inLinkStr ); |
250 | 256 | } |
251 | 257 | // hack to remove newline from beginning of output, thanks to |
252 | 258 | // http://jimbojw.com/wiki/index.php?title=Raw_HTML_Output_from_a_MediaWiki_Parser_Function |