Edit Review Improvements/New filters for edit review/How to implement a filter

Product and design


There are first some product and design questions to answer:


 * Purpose and effect of the filter - Consider the user experience and use cases. This will both help you decide what the filter does, and how to describe it.
 * Choose text - You will need a label and description, which will be placed as shown in the image User registration. Both have to be concise.  You will also need a group title if you are creating a new group; you can also optionally specify What's This? text to provide more information about the group.

Listener
Register a listener for the 1>Manual:Hooks/ChangesListSpecialPageStructuredFilters|ChangesListSpecialPageStructuredFilters hook. That will give you access to, a [https://doc.wikimedia.org/mediawiki-core/master/php/classChangesListSpecialPage.html ChangesListSpecialPage] instance used below.

Group
First, choose whether you want to create a ChangesListStringOptionsGroup or a ChangesListBooleanFilterGroup.

is best if you have many options, they are not naturally expressed as hide-based (e.g. hideanons) filters, and/or they are not full coverage (full coverage means checking all boxes in a group is the same as checking no boxes).

is best for existing hide-based filters (like ), or filters that can be expressed simply using that idea.

If you are creating a new group, create an object for that.

The  is an internal identifier.

However, for, it's also used as the URL parameter. Either (see above):

or:

Either way, you then register the group with:

You can optionally include information for a What's This? popup ( ,  ,  , and  </> - see the thumb image).

If you need to access an existing group (e.g. defined by core), instead use:

Filters
Regardless of whether you created a group, you will want to add filters to new or existing groups.

If all the filters belong to a group you're creating, you should put the definitions in the  parameter of the group constructor; this will automatically order them for you. To add filters to pre-existing groups, follow the below instructions.

There are currently two types of filter, <tvar|boolfil>ChangesListBooleanFilter</> and <tvar|strfil>ChangesListStringOptionsFilter</>.

They each go only in the group with the matching type. The 'name' is used as an identifier, which also appears in the URL. Use:

or:

You do not have to do anything after constructing the filter.