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?

1 Answer 1


You should use an extension. See here:


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


To see all of the various parts, you can use

$formValues = $form_state->getUserInput();

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


to set a value.

  • As above, I used a hook successfully but can't find the right thing to edit on D8/9 Commented May 16, 2023 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.