processwire / processwire-requests

ProcessWire feature requests.
39 stars 0 forks source link

Allow fields to select their inputfield, so new Inputfield modules don't always have to include a Fieldtype module #470

Open Toutouwai opened 1 year ago

Toutouwai commented 1 year ago

Short description of the enhancement

If I understand right, every new inputfield module must be bundled with its own fieldtype module even if one of the core fieldtype modules is already sufficient to hold the inputfield's value. That seems like something that could be improved on.

Take a fieldtype such as FieldtypeInteger. There could be many potential inputfields developed that will set an integer value via different types of interface.

Let's say I want to create an inputfield that will set an integer value via a slider interface. I can't just release InputfieldSlider because PW doesn't provide any way to select that inputfield as the input type for a FieldtypeInteger field. So I must also bundle in a FieldtypeSlider module that does nothing useful - it just extends FieldtypeInteger and specifies that the inputfield to be used is InputfieldSlider.

Maybe there could be some way that inputfield modules can indicate what fieldtype is needed to store their data, and then fields using that fieldtype would have a config option where the user can select between the compatible inputfield modules that are installed.

This request is an expanded version of an existing request: https://github.com/processwire/processwire-requests/issues/340 When developing FieldtypeStars I realised that it's an issue that applies more generally to inputfields and fieldtypes.