steveooo Posted February 18, 2016 Share Posted February 18, 2016 Hello guys, I want to write my first module and I read a lot about fieldtypes and inputfields. I really don't get the difference between the two. I hope someone can explain it to me! Maybe it is easier to tell what I want to do and you could tell me what roles fieldtypes and inputfields have with this module I want to create. I want to create a field that consists of multiple fields (text, textarea). It should be a field that wraps some other fields, so I don't have to install 10 different fields every time. How would I achieve this in regards of fieldtypes and inputfields (and data storage)? Thanks! Link to comment Share on other sites More sharing options...
cstevensjr Posted February 18, 2016 Share Posted February 18, 2016 This information may help you https://processwire.com/api/fieldtypes/validation-fieldtypes-vs-inputfields/ 2 Link to comment Share on other sites More sharing options...
steveooo Posted February 18, 2016 Author Share Posted February 18, 2016 Hello, I read that, but still I do not really get the difference. It would be nice if someone would explain it to me with my example. For example this module is a SEO module (I know MarkupSEO!) that adds a own 'seo_stuff' field to every page. 'seo_stuff' consists of multiple fields like 'seo_description' as textarea and 'seo_keywords' as string. Just a test project for better understanding. Link to comment Share on other sites More sharing options...
BitPoet Posted February 18, 2016 Share Posted February 18, 2016 A good place to start reading would also be the Map Marker field module, which Ryan created as an example. In short: The Fieldtype is responsible for taking care of saving to and loading from the database as well as sanitizing values, creating the database table(s) and assembling the correct database query from a selector. The Inputfield renders the input form elements and processes form input. InputfieldMapMarker generates its input elements manually in the render method, but you can also use InputfieldXXX modules (like it does in ___getConfigInputfields) and add those to an InputfieldWrapper, then render that. 5 Link to comment Share on other sites More sharing options...
cstevensjr Posted February 18, 2016 Share Posted February 18, 2016 Did you also read the link (source) that was referenced in the documentation, I referred you to? https://processwire.com/talk/topic/2588-feature-request-page-id-attribute/?p=28758 1 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