Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow test mode in webform test #949

Draft
wants to merge 1 commit into
base: 6.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,6 @@ protected function wf_crm_get_fields($var = 'fields') {
// Removed due to error, when a custom element is made, revisit.
// 'value_callback' => TRUE,
];
$fields['contribution_is_test'] = [
'name' => t('Payment Processor Mode'),
'type' => 'hidden',
'expose_list' => TRUE,
'value' => 0,
'weight' => 9996,
];
$fields['contribution_note'] = [
'name' => t('Contribution Note'),
'type' => 'textarea',
Expand Down
4 changes: 4 additions & 0 deletions src/WebformCivicrmPostProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ public function validate($form, FormStateInterface $form_state) {
}
}

if (!empty($this->data['contribution'])) {
$this->data['contribution'][1]['contribution'][1]['is_test'] = (int) $this->node->isTest();
}

$this->validateThisPage($this->form);

if (!empty($this->data['participant']) && !empty($this->data['participant_reg_type'])) {
Expand Down
4 changes: 4 additions & 0 deletions src/WebformCivicrmPreProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ function initialize(array &$form, FormStateInterface $form_state, WebformHandler
* Set webform default values.
*/
public function alterForm() {
if (!empty($this->data['contribution'])) {
$this->data['contribution'][1]['contribution'][1]['is_test'] = (int) $this->node->isTest();
}

// Add css & js
$this->addResources();
// Add validation handler
Expand Down
Loading