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

Creating a widget has a few important steps that should be followed.

Steps

  1. Find embedding code on provider's site
    Paste 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.
  2. 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 below
    • urlpathinfo - should be used it variable is part of the URL
    • html - 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 escape modifier with other modifiers like default, you can separate them with a pipe like this:

    Hello, <b><!--{$name|default:'guest'|escape:'html'}--></b>!
    

    List of available validators

    Widgets extension implements validate modifier that uses PHP Data filtering to allow validating widget parameters.

    To make sure $homepage variable 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)
  3. Create widget description page
  4. Add a link to catalog on home page of MMW.org
    * [[{$widget-name}]] widget

    Summary: Added {$widget-name} widget /* Widgets available */ 
  5. 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 */
  6. Find existing extensions that provide this service
  7. Add all categories from Widgets found to the Widget page
  8. Add links in See Also section of all those extensions
    Add 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 */ 
  9. Send email announcing new widget to a mailing list
    Subject: New {$widget-name} Widget

    Body:

    Thanks to {$author}, we now have {$widget-name} widget!

    Feel free to grab it here: http://www.mediawikiwidgets.org/{$widget-name.underscoreencoded}

             Sergey
  10. Tweet it
    Post a short message, 140 symbols max.