CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • drupal_get_form equivalent? or...?
Pages: [1]

Author Topic: drupal_get_form equivalent? or...?  (Read 1022 times)

Eman0684

  • Guest
drupal_get_form equivalent? or...?
March 21, 2009, 10:09:43 pm
Is there an equivalent to drupal's function to get a form by name so it can be embedded someplace else?

Or a few other questions if the answer is no (even if the answer is yes, I'd like to know these things):

I already know how to remove "steps" from a form, but how can I consolidate them? E.g how can I add step 3 of the mailing wizard to step 2? (just pasting template code doesn't work).
What's the procedure for adding an additional field to a form? (saw the build_form hook but I don't know if I did something wrong, since it didn't work)
Is there an equivalent to drupal_execute (or node_form_submit or any such functions that allow form submission using programmatic means)?
« Last Edit: March 22, 2009, 06:19:18 am by Eman0684 »

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: drupal_get_form equivalent? or...?
March 22, 2009, 07:30:05 am
Quote from: Eman0684 on March 21, 2009, 10:09:43 pm
Is there an equivalent to drupal's function to get a form by name so it can be embedded someplace else?

No function that replaces that, but i suspect we can write one fairly easily. Check:

CRM/Core/BAO/UFGroup.php, function getEditHTML() where we embed a profile form in drupal registration / my account pages. So a wrapper should be able to simulate the drupal_get_form functionality. Ping us on IRC if you want help and want to move forward with this

Quote from: Eman0684 on March 21, 2009, 10:09:43 pm
I already know how to remove "steps" from a form, but how can I consolidate them? E.g how can I add step 3 of the mailing wizard to step 2? (just pasting template code doesn't work).

No easy programmatic way, you'll need to merge the php form files and the tpl files (or use the hooks)

Quote from: Eman0684 on March 21, 2009, 10:09:43 pm
What's the procedure for adding an additional field to a form? (saw the build_form hook but I don't know if I did something wrong, since it didn't work)

In addition to the buildForm hook, you'll need to modify the tpl and expose the field in the tpl file. We need to figure out how to potentially do this in one hook only (i.e. buildForm hook will inject the fields automatically in tpl) if the user does not want to mess with the tpl file. Only issue is user wont be able to control placement of form field in the tpl file. Get on IRC if you want to help us build this functionality

Quote from: Eman0684 on March 21, 2009, 10:09:43 pm
Is there an equivalent to drupal_execute (or node_form_submit or any such functions that allow form submission using programmatic means)?

getEditHTML does both (the view and the execute). We can split it into two pieces if needed. Big issue is that the values need to be in $_POST since quickform retrieves and validates it from $_POST

We'd be happy to increase the functionality of the current hooks and make things more customizable. Ping us on IRC :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • drupal_get_form equivalent? or...?

This forum was archived on 2017-11-26.