Extension:Page Forms/Developers' documentation

This page holds information about the code, for developers who want to better understand it, modify it, or create code that ties into it.

Code structure
For the complete listing of files in and a short description of each one, see the Code structure page.

To view the code online, including version history for each file, you can go [ https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/PageForms/+/refs/heads/master here].

Modifying or improving Page Forms
There's certainly no shortage of ways to improve, including bugs that can be fixed, interface elements that can be improved, or new features that can be added. If you are a developer, or simply a user with some technical skill, any help you can provide in improving the software is welcome: would not be at its current state without the contributions of many people.

If you encounter some issue or limitation in, and have an interest in fixing it, please either write Yaron , write about it on the talk page, or post a task on [ https://phabricator.wikimedia.org/maniphest/task/edit/form/1/ Phabricator].

You can also see the current list of Known bugs and planned features.

Defining new inputs
To create a new input type, you need to define a class for that input, and have it inherit (using the "extends" keyword) from the class PFFormInput, or one of its child classes. There are a number of methods that this class can or should define; the following are the crucial ones:


 * - sets the name of the input within the form definition.
 * - defines which parameters can be be passed in to this input, for use within Special:CreateForm.
 * - defines the HTML to display this input.
 * - sets the name(s) of the ResourceLoader modules used by this input; if the input contains any JavaScript or CSS, they should be packaged into one or more modules, which are then specified here.

Other methods that can be overridden include the following:

It's useful to look at the existing form input classes to see how all these functions are called.

One note on getting other parameters: let's say that your input is named "myinput", and is called in the form definition in the following way:

Within your class's method,  will contain the "color=orange" and "height=200" key-value pairs, which the function can then use however it wants.

Finally, once your new input is defined, it needs to be registered. You do that by using the hook. You need to register with that hook a function that looks like the following:

Testing
You can find information on testing the code at the page Testing.