How to Install and Configure the PageForms Extension for MediaWiki
Why PageForms?
PageForms (formerly Semantic Forms) lets you turn templates into user‑friendly forms. It’s the go‑to solution for structured data entry, bulk editing, and query forms – all without writing PHP.
Prerequisites
- MediaWiki ≥ 1.40 (the latest stable release is recommended).
- PHP ≥ 7.4 (the same version that your MediaWiki core uses).
- Optional: Semantic MediaWiki or Cargo if you want semantic querying. PageForms works without them.
Step 1 – Download the extension
You have three safe ways to obtain the code. The most reproducible method is Composer; the manual git clone works as well.
Composer (recommended)
composer require mediawiki/page-forms "^6.0"Composer will place the extension under extensions/PageForms and add an entry to composer.local.json.
Git clone
cd extensions
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PageForms.gitAfter cloning, make sure the directory name is exactly PageForms.
Manual zip download (not recommended for production)
Download the zip from the official page and extract it to extensions/PageForms.
Step 2 – Enable the extension
Add a single line to your LocalSettings.php (preferably near the other wfLoadExtension calls):
wfLoadExtension( 'PageForms' );Clear the parser cache (e.g. add ?action=purge to a wiki page) and reload the site – the extension should now be active.
Step 3 – Basic permission setup
PageForms defines four custom rights. By default:
viewedittab– everyone can see the “Edit with form” tab.createclass– all registered users can create new classes viaSpecial:CreateClass.editrestrictedfields– only sysops can edit fields markedrestricted.multipageedit– all users can use the spreadsheet‑style bulk editor.
If you want tighter control, add something like:
$wgGroupPermissions['*']['viewedittab'] = false; // hide the tab for anonymous users
$wgGroupPermissions['sysop']['viewedittab'] = true; // only admins get it
Step 4 – Create a data model (quick start)
The fastest way to get a working form is the built‑in Special:CreateClass special page. It asks for:
- Property names and types (e.g.
Has author→Page). - Template name (e.g.
Book). - Form name (e.g.
Book). - Category name (e.g.
Books).
After you submit, MediaWiki automatically creates:
- Property pages under
Property:. - A template
Template:Bookthat stores the data. - A form
Form:Bookfor data entry. - A category
Category:Bookswith the default form set.
Visit Special:CreateClass and follow the wizard – you’ll have a working “Add a book” form in seconds.
Step 5 – Manual creation (advanced)
If you prefer fine‑grained control, create each component yourself.
- Properties:
Special:CreatePropertyor a page like[[Property:Has author|{{#set: Has author = Page }}]]. - Category default form: Edit the category page and add a line like
[[Has default form::Book]]or use#default_forminside the template.
Form: In the Form: namespace, use the PF markup language:
{{#forminput:form=Book}}
{{{for template|Book}}}
|-
! Title:
| {{{field|Title}}}
|-
! Author:
| {{{field|Author|input type=autocomplete}}}
|-
! Year:
| {{{field|Year|input type=year}}}
{{{end template}}}
{{{standard input|free text|rows=5}}}
{{{standard input|summary}}}
{{{standard input|save}}}Template: In the Template: namespace, write a table that maps form fields to semantic properties, e.g.
{{#if:{{{Title|}}}|'''Title'''::{{{Title}}}}
{{#if:{{{Author|}}}|'''Author'''::{{{Author}}}}
{{#if:{{{Year|}}}|'''Year'''::{{{Year}}}}Step 6 – Optional configuration tweaks
PageForms ships with a handful of $wgPageForms* variables. The most useful are:
$wgPageFormsAutocompleteCacheTimeout– seconds before autocomplete results are refreshed (default 300).$wgPageFormsUploadableFields– enables theuploadableparameter on file fields.$wgPageFormsEnableMultiPageEdit– turn the bulk‑edit spreadsheet on or off.
Set them in LocalSettings.php:
$wgPageFormsAutocompleteCacheTimeout = 600; // 10 minutes
$wgPageFormsUploadableFields = true;Step 7 – Test the installation
- Navigate to
Special:CreateClassand create a tiny test class (e.g. “TestItem”). - After the wizard finishes, click the “Add a TestItem” link that appears on the category page.
- Fill in a few fields and hit “Save”.
- Verify that the page displays the data as defined in the template and that the “Edit with form” tab appears on the new page.
If anything goes wrong, check the MediaWiki error log and the parser cache (purge the page). The extension also logs to Special:Log under the “pageforms” type.
Conclusion
With a few commands you now have a powerful data‑entry engine on your wiki. PageForms scales from a single form to dozens of interconnected classes, supports bulk editing, and integrates seamlessly with Semantic MediaWiki or Cargo when you need advanced querying.
For deeper customisation (conditional fields, repeatable sections, or custom JavaScript), consult the official documentation and the quick‑start guide.