Jump to content

Module options


tuxy
 Share

Recommended Posts

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???  :huh:

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

  • Like 1
Link to comment
Share on other sites

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. 

  • Like 2
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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. 

  • Like 2
Link to comment
Share on other sites

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).

  • Like 1
Link to comment
Share on other sites

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 ;) ).

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...