How-To: Create new MediaWiki Widget: {$widget-name}

Creating a widget has a few important steps that should be followed.
Steps
- Find embedding code on provider's sitePaste the URL form the place where you find the code into provider-wizard-url so it's easier for people to find where it is if they want to contribute changes.
- Create widget a page in Widget: namespace
List of most commonly used 'escape' modifier values
quotes- should be used only if variable is enclosed within single quotes. For double quotes (e.g. HTML tag attributes) see 'html' modifier belowurlpathinfo- should be used it variable is part of the URLhtml- should be used if variable is included directly as part of HTML or as HTML tag parameter (e.g. enclosed in quotes "" - don't use 'quotes' modifier in this case!)
If you need to combine
escapemodifier with other modifiers likedefault, you can separate them with a pipe like this:Hello, <b><!--{$name|default:'guest'|escape:'html'}--></b>!List of available validators
Widgets extension implements
validatemodifier that uses PHP Data filtering to allow validating widget parameters.To make sure
$homepagevariable value is a valid URL, you can use following code:<a href="<!--{$homepage|validate:url}-->">Homepage</a>Following values for the validate are supported by Widgets extension (mapping to corresponding PHP's validation filters):
url(FILTER_VALIDATE_URL)int(FILTER_VALIDATE_INT)boolean(FILTER_VALIDATE_BOOLEAN)float(FILTER_VALIDATE_FLOAT)email(FILTER_VALIDATE_EMAIL)ip(FILTER_VALIDATE_IP)
- Create widget description page
- Add a link to catalog on home page of MMW.org* [[{$widget-name}]] widget
Summary: Added {$widget-name} widget /* Widgets available */ - Add a link to catalog on Widgets page on MW.org* [http://www.mediawikiwidgets.org/{$widget-name.underscoreencoded} {$widget-name}] widget
Summary: Added {$widget-name} widget /* Widget library */ - Find existing extensions that provide this service
- Add all categories from Widgets found to the Widget page
- Add links in See Also section of all those extensionsAdd this code to existing See Also section or create one:
== See Also ==
* [http://www.mediawikiwidgets.org/{$widget-name.underscoreencoded} {$widget-name} widget] on MediaWikiWidgets.org site, it uses [[Extension:Widgets|Widgets]] extension.
Summary: Added link to {$widget-name} widget /* See also */
Send email announcing new widget to a mailing list
Tweet itPost a short message, 140 symbols max.
