Question

I am looking for possible filters' list when adding parameters' field for a module settings.

I know that filter="raw" and filter="integer" exists from examples at Text form field type.

But what are other possible filters for these fields?

Was it helpful?

Solution

I am not totally sure if this is it, but may want to see this list directly from the code, with the method clean().

So the list would be:

  • INT / INTEGER
  • UINT
  • FLOAT / DOUBLE
  • BOOL / BOOLEAN
  • WORD
  • ALNUM
  • CMD
  • BASE64
  • STRING
  • HTML
  • ARRAY
  • PATH
  • USERNAME
  • RAW

Let me know if this helps.

OTHER TIPS

Posting as a guest so I couldn't comment ;) You might also find the list of available field types useful for capturing data like URLs and emails. You can find the full list here. Also available in the folder structure at libraries/cms/form/field and libraries/joomla/form/fields. There are URL and email fields which, I believe, include the relevant filtering. Usage would be as follows in the .xml:

<field name="myAwesomeURL" type="url" class="awesome"></field>

This renders as a text input box.

To be precise, Joomla starts applying the filter with this filterField function. In this code, you can see some more filter types like TEL, SAFEHTML or so. From this function, if there's no match, it will go further to the one mentioned by @ValentinDespa. It also enables you to call your own function, as long as it's "callable". I found out this scattering after I looked into code by another dev having filter="intval".

Hope that helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top