public function Basic::processBuildConfigurationForm in Payment 8.2
Implements a form API #process callback.
File
- src/
Plugin/ Payment/ MethodConfiguration/ Basic.php, line 233
Class
- Basic
- Provides the configuration for the payment_basic payment method plugin.
Namespace
Drupal\payment\Plugin\Payment\MethodConfigurationCode
public function processBuildConfigurationForm(array &$element, FormStateInterface $form_state, array &$form) {
$element['brand_label'] = array(
'#default_value' => $this
->getBrandLabel(),
'#description' => $this
->t('The label that payers will see when choosing a payment method. Defaults to the payment method label.'),
'#title' => $this
->t('Brand label'),
'#type' => 'textfield',
);
$workflow_group = implode('][', array_merge($element['#parents'], array(
'workflow',
)));
$element['workflow'] = array(
'#type' => 'vertical_tabs',
);
$element['execute'] = array(
'#group' => $workflow_group,
'#open' => TRUE,
'#type' => 'details',
'#title' => $this
->t('Execution'),
);
$element['execute']['execute_status'] = $this
->getExecutePaymentStatusSelector($form_state)
->buildSelectorForm([], $form_state);
$element['capture'] = array(
'#group' => $workflow_group,
'#open' => TRUE,
'#type' => 'details',
'#title' => $this
->t('Capture'),
);
$capture_id = Html::getUniqueId('capture');
$element['capture']['capture'] = array(
'#id' => $capture_id,
'#type' => 'checkbox',
'#title' => $this
->t('Add an additional capture step after payments have been executed.'),
'#default_value' => $this
->getCapture(),
);
$element['capture']['plugin_form'] = [
'#type' => 'container',
'#states' => [
'visible' => array(
'#' . $capture_id => array(
'checked' => TRUE,
),
),
],
];
$element['capture']['plugin_form']['capture_status'] = $this
->getCapturePaymentStatusSelector($form_state)
->buildSelectorForm([], $form_state);
$refund_id = Html::getUniqueId('refund');
$element['refund'] = array(
'#group' => $workflow_group,
'#open' => TRUE,
'#type' => 'details',
'#title' => $this
->t('Refund'),
);
$element['refund']['refund'] = array(
'#id' => $refund_id,
'#type' => 'checkbox',
'#title' => $this
->t('Add an additional refund step after payments have been executed.'),
'#default_value' => $this
->getRefund(),
);
$element['refund']['plugin_form'] = [
'#type' => 'container',
'#states' => [
'visible' => array(
'#' . $refund_id => array(
'checked' => TRUE,
),
),
],
];
$element['refund']['plugin_form']['refund_status'] = $this
->getRefundPaymentStatusSelector($form_state)
->buildSelectorForm([], $form_state);
return $element;
}