Score:1

How do I use a hook to modify CiviCRM payment processor details in Webform?

jp flag

I am trying to use hook_form_alter() to change the details of the CiviCRM Payment Processor for specific users (to change from live mode to test mode).

On Drupal 7 it's in $form['submitted'] when Page 2 is rendered. Many items are already there on Page 1, but this is not.

Are these somewhere else, or do I have to use a different mechanism, in Drupal 9?

Score:0
cn flag

You should use an extension. See here:

https://docs.civicrm.org/dev/en/latest/hooks/

But that's for CiviCRM hooks. Drupal hooks indeed still work in a .module file. Docs are here:

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21form.api.php/function/hook_form_alter/9

To see all of the various parts, you can use

$formValues = $form_state->getUserInput();
print_r($formValues);die;

once, in order to see all the values. You can then use

$form_state->setValue();

to set a value.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.