⚈ Kuopassa.net

Lisää kertomuksia netistä. 摆烂

Some notes of zem_contact_reborn´s finput

This is just a note mainly for myself so that I won´t hopefully lose this information. It took a while to gather it. Maybe it´s useful also for your project. As Textpattern´s plugin zem_contact_reborn has some sort of API thingy which allows other plugins and other code to communicate with zem_contact_reborn, I got excited enough to try to actually do something useful with it. There´s hopefully going to be as a part of my MailChimp for Textpattern plugin a checkbox to subscribe to a newsletter when submitting zem_contact_reborn. That´s so far half way done.

So here´s the juicy part. zem_contact_reborn has a tag builder or function or something called finput. That can be filled with attributes and it then can be hooked to the contact form plugin with another bit of code. The finput has syntax like this:

finput('checkbox','kuo_mailchimp_subscribe','1','checkbox kuo_checkbox','Subscribe to our newsletter','','','','kuo_mailchimp_subscribe','','');

The code example above is filled with my MailChimp for Textpattern´s attributes. The point here is that function will create a proper checkbox element when executed with zem_contact_reborn. The attributes and stuff are separated with commas. They mean from left to right the following:

  1. type
  2. name
  3. value
  4. class
  5. title
  6. onclick
  7. size
  8. tabindex
  9. id
  10. disabled
  11. required

So the number one here is checkbox, it´s name is (in the code example) kuo_mailchimp_subscribe and it´s value is 1.

About the author