Extension:AssembleFormLink

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg
AssembleFormLink

Release status:Extension status experimental

ImplementationTemplate:Extension#type Parser extension
DescriptionTemplate:Extension#description Provides helper forms to choose the correct page title for a semantic form.
Author(s)Template:Extension#username Simon Heimler (Fannontalk)
Latest versionTemplate:Extension#version 0.0.1 (November 2014)
MediaWikiTemplate:Extension#mediawiki 1.19+
PHPTemplate:Extension#php 5.2+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license MIT License
Download
README
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit
BeforePageDisplayManual:Hooks/BeforePageDisplay

Translate the AssembleFormLink extension if it is available at translatewiki.net

Check usage and version matrix.

The AssembleFormLink extension provides a parser function that allows to build simple helper forms on a page (in display mode). They enquire all necessary data to create a correct and consistent URL when creating a new page through a Semantic Form.

Installation[edit]

Note Note: This extension requires Semantic MediaWiki and Semantic Forms to be installed first.


  • Download and place the file(s) in a directory called AssembleFormLink in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/AssembleFormLink/AssembleFormLink.php";
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


Instead of downloading the tarball you may also check this extension out via Git:

git clone https://github.com/Fannon/AssembleFormLink.git

Usage[edit]

Example[edit]

  • This will link to a new form of type NaturalPerson
  • In order to provide a name / label use the category NaturalPerson
  • Ask for the first name through a textfield of size 16, use "First Name" as a placeholder
  • Add a comma and a space (', ')
  • Ask for the last name through a textfield of size 20, use "Last Name" as a placeholder
  • Set the category min-width to 140px. This is to provide a more consistent visual layout if many AssembleFormLinkare used.
{{#assembleFormLink:NaturalPerson
| category=NaturalPerson=Natural person
| firstname=textfield[placeholder=First name][size=16]
| commaspace
| lastname=textfield[placeholder=Last name][size=20]
| category-min-width=140px
}}

Further Examples[edit]

{{#assembleFormLink:JuristischePerson
| category=JuristischePerson=Juristic person
| firmenname=textfield[placeholder=Company name][size=49]
| category-min-width=140px
}}
{{#assembleFormLink:FirmenStandort
| category=CompanyLocation
| strasse=textfield[placeholder=Street][size=22]
| space1
| plz=textfield[placeholder=zip][size=6]
| space2
| stadt=textfield[placeholder=city][size=12]
| category-min-width=140px
}}

Result (Screenshot)[edit]

CreateFormLinkExample

Available Options[edit]

Seperators[edit]

Following Seperators are currently supported: slash, space, comma and commaspace. It is possible to provide free text as seperator too, but beware of escaping.

If a separator needs to be included more than once, it has to be enumerated: slash1, slash, etc.

Forms[edit]

Currently only input type text (textfield) is supported.

Additional Options can be supported through [attributeName=Value]. They will be translated into HTML attributes.

Additional Options[edit]

  • category-min-width=140px Sets the category min-width to 140px. This is to provide a more consistent visual layout if many AssembleFormLink are used.
  • category-include-in-url If given, the category will be included in the URL. This is useful if namespaces should be created.
  • submit-text=CREATE Overrides the text of the submit button.

Global Options[edit]

  • $wgAssembleFormLinkSubmitText = 'CREATE'; Defines a global default submit button text.