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) »
  • Alter values using hook_civicrm_postProcess()
Pages: [1]

Author Topic: Alter values using hook_civicrm_postProcess()  (Read 467 times)

awasson

  • I post frequently
  • ***
  • Posts: 230
  • Karma: 7
  • Living in a world of Drupal / CiviCRM
    • My Company: Luna Design
  • CiviCRM version: Latest
  • CMS version: Drupal 6/7/8
  • MySQL version: 5.x
  • PHP version: 5.3.x
Alter values using hook_civicrm_postProcess()
March 25, 2014, 11:37:51 pm
I think this is possible but I thought I'd check first.

I'd like to alter some values in the _params array for a particular contribution form using hook_civicrm_postProcess().

So far I've got a conditional that detects when the form is a contribution confirmation form and that pay_later == true. Then I use $params = $form->getVar('_params'); to expose the data I need. Once I process the data, I'd like to update the $form->_params.

Is there a best practice for doing that?

Thanks,
Andrew
My CiviCRM Extension Workshop: https://github.com/awasson

awasson

  • I post frequently
  • ***
  • Posts: 230
  • Karma: 7
  • Living in a world of Drupal / CiviCRM
    • My Company: Luna Design
  • CiviCRM version: Latest
  • CMS version: Drupal 6/7/8
  • MySQL version: 5.x
  • PHP version: 5.3.x
Re: Alter values using hook_civicrm_postProcess()
March 26, 2014, 10:39:42 am
Ok, I've done a little tinkering and it seems to me that the best way to do this is as follows (in case someone else has this question):

You can alter values in the $form object using hook_civicrm_postProcess() but since it is a postProcess() function, it doesn't really do a heck of a lot.

My CiviCRM Extension Workshop: https://github.com/awasson

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Alter values using hook_civicrm_postProcess()

This forum was archived on 2017-11-26.