theoretic Posted March 29, 2018 Share Posted March 29, 2018 Hi there! And thanks for Processwire! Maybe i'm not very attentive but couldn't find any tutorial on creating custom fieldtype with custom inputfield. Would like to make one for selecting color(s) from predefined list of colors. The closest existing match is FieldtypeSelectOptions with InputfieldSelect but i need something different. There's a very good post from @Soma which is, however, insufficient to begin building my own fieldtype or at least to attach the existing inputfield to an existing field. Will appreciate any help. Thanks in advance! Link to comment Share on other sites More sharing options...
neosin Posted March 29, 2018 Share Posted March 29, 2018 @theoretic there is such a field type for color https://modules.processwire.com/modules/fieldtype-color/ and also a module for color picker https://modules.processwire.com/modules/fieldtype-color-picker/ if they don't solve your request, you can inspect their code and see how to do it hope this helps 3 Link to comment Share on other sites More sharing options...
Robin S Posted March 29, 2018 Share Posted March 29, 2018 3 hours ago, theoretic said: creating custom fieldtype with custom inputfield 3 hours ago, theoretic said: attach the existing inputfield to an existing field Those two things contradict each other somewhat. If you are creating a new custom fieldtype then there won't be any existing field data until you create your fieldtype module and start using it in pages. 3 hours ago, theoretic said: but couldn't find any tutorial on creating custom fieldtype with custom inputfield There is the Events fieldtype and inputfield which was created specifically as a proof-of-concept for developers to learn from. But it extends FieldtypeMulti (each field instance saves/shows multiple repeated items) so that might not suit what you are wanting to do. I don't think Ryan made a similar proof-of-concept for a straight Fieldtype. But in a way all the Fieldtype modules in the core and in the modules directory are a proof-of-concept - find a fieldtype that is broadly similar to what you want to do and check out (borrow from ) the code. Also, the documentation for the Fieldtype class will be useful. Perhaps if you describe exactly what you want the fieldtype/inputfield to do people can give you more suggestions. 4 Link to comment Share on other sites More sharing options...
kixe Posted March 30, 2018 Share Posted March 30, 2018 Some time ago, I started to develop a module that provides a predefined (field settings) list of colors as a supplement to the FieldtypeColor module. Quite expensive and therefore unfortunately remained. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now