Search code examples
phphtmlparsingexternalmediawiki

How to limit characters of a subject plain text field of MediaWiki ContactPage extension?


In MediaWiki 1.33.0 I have a ContactPage contact form with HTMLForm default template.
This contact form contains a subject plain text field with the HTML name attribute of wpSubject.

My problem

For some reason $wgContactConfig['default'] = array() which contains the HTMLForm default template, doesn't include the subject plain text field code.

This prevents me from doing what I desire, which is to limit the amount of characters of that subject plain text field with PHP.

What I have tried

Given the form is parsed from an HTMLForm template engine, I searched for a solution in HTMLForm manual and found only the min and max values,
but these values seems to me to limit integer number values and not a field's character amount.

My question

How to limit characters of a subject plain text field of MediaWiki ContactPage extension?


Solution

  • Normally you'd use the validation-callback option for this, but there isn't really any way to modify the configuration of predefined fields in ContactPage, as far as I can see from the code.