-----------------------------------
Custom (app specific) field types
-----------------------------------
Applications can add their own custom field types, which should be derived from :code:`BaseField` or one of its descendants.
A very simple single item custom field type could look like this:
Build the field type
........................................
.. code-block:: php
'can not use a reserved word',
'domain' => $reservedwords));
}
return $validators;
}
This example extends the standard validations with a list of reserved words, in which case it would yield :code:`can not use a reserved word`
if one of the reserved words are provided.
.. Note::
This file should be placed in the subdirectory :code:`FieldTypes` of the model itself.
.. Tip::
Use :code:`BaseListField` as simple template for list type items.
Use in model
.................
The validation can be used as any standard type, when prefixed with :code:`.\ ` the model knows it concerns a local field.
.. code-block:: xml
//OPNsense/MyFirst/App
1.0.0
My first application
Y
.. Tip::
Inspect the `basic field `__ types
for inspiration, a concrete example of a custom field type can be found in the
`firewall `__ section