tuxy Posted February 10, 2015 Posted February 10, 2015 Hello PW'ers, I'm a PW newbie and my first post in this forum. In the last years i was a 'hardcore' Drupal user, but i'm confused about the 'bloated' code. Make your own Drupal-theme is a hell. A few days ago I find PW. My first impression, HOW WORKS THIS??? Reading many posts in this forum, and a lot of searching on the net for good simple tutorials to understand PW. Today follow a first 'beginner' tutorial, finding in Docs of the PW-site. Wauw!! Thats an amazing CMS/CMF. I searching for a tutorial how make a select/dropdown/tag-list (similar as 'Taxonomies' in Drupal) and find it: http://wiki.processwire.com/index.php/Page_Field I try it succesfully. Ok, I have a question: I found a good tutorial in this forum how make a simple form (thanks @soma!). But how know with options a module have? Example: $field = $modules->get("InputfieldText"); $field->label = "Name"; $field->attr('id+name','name'); $field->required = 1; $form->append($field); In the above code, i see a label, attr, required But how can I know with options are available for a module? PS: Sorry for my bad english Regards, Christophe 1
LostKobrakai Posted February 10, 2015 Posted February 10, 2015 This API was never intended to be used by developers other than for modules, that's why there is little documentation besides the thread you've mentioned. The best solution would be taking a look at the files itself: wire/core/Inputfield.php & all those wire/modules/Inputfields/*.module. Most of them do have a fair amount of comments, so you should get along after some time. P.S. It would be nice to ask such questions in the thread it belongs to. 2
tuxy Posted February 10, 2015 Author Posted February 10, 2015 This API was never intended to be used by developers other than for modules, that's why there is little documentation besides the thread you've mentioned. The best solution would be taking a look at the files itself: wire/core/Inputfield.php & all those wire/modules/Inputfields/*.module. Most of them do have a fair amount of comments, so you should get along after some time. P.S. It would be nice to ask such questions in the thread it belongs to. Hi @LostKobrakai, Thx for the fast reply. Hmm, ok. I look inside the (core) modules. My apologies for this wrong tread! Christophe
ryan Posted February 11, 2015 Posted February 11, 2015 Christophe, glad you are enjoying ProcessWire. There are a common set of properties available to all Inputfields, and then there are properties unique to each of them. One of the simplest ways to find those properties is to look at the @property tags at the top of the module file. Not all modules have these yet, but we're working on having them all in for PW 2.6. Here are the properties (link) common to all Inputfields, which you can see at the top of Inputfield.php. Another way to identify properties unique to an Inputfield is to make sure you've got debug mode on (in your /site/config.php file) and then go and edit any field in Setup > Fields, that happens to use the Inputfield you are interested in. Click on the "Input" tab, and you'll generally see most of the custom properties configurable from there. Hover over the little caret symbol to the far right of the field, and the API property name will reveal itself in the field label. LostKobrakai is also correct that Inputfield modules are originally intended more for admin and module use rather than front-end site use (since PW is mostly not involved in markup generation for front-end). But as more people begin to use these modules in new ways, we'll likewise try to make documentation about them more accessible. 2
pwFoo Posted February 11, 2015 Posted February 11, 2015 Hi Ryan, would be great get core modules (inputfields, form api, ...) documented and also usable in the frontend (so far it's possible and make sense ).
LostKobrakai Posted February 11, 2015 Posted February 11, 2015 They're already usable, they just wheren't intentionally developed for that. Only documentation is lacking, while Soma's topic and the comments in the mentioned core files do already cover most of the information, just not in a very easy-to-enter way. And there's still FormBuilder, which does provides a grafical ui for setting up fields (and lots more). 1
pwFoo Posted February 11, 2015 Posted February 11, 2015 Some modules missing parameters to make sense or useable in the frontend. Instead of hacks or additional hooks to do changes it should be realized with some more parameters during module load in the frontend. But maybe a improved documentation should do it. Form api is great. I use it everywhere I working with PW forms!!! There are some helpful and great topics here (special thanks to Soma ).
tuxy Posted February 11, 2015 Author Posted February 11, 2015 Hi guys, Thanks for all these clear info. You are helpful people! I like it Regards, Christophe Grtz from Belgium! 1
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