public function WorldpayRedirect::validateConfigurationForm in Commerce Worldpay 8
Same name and namespace in other branches
- 8.2 src/Plugin/Commerce/PaymentGateway/WorldpayRedirect.php \Drupal\commerce_worldpay\Plugin\Commerce\PaymentGateway\WorldpayRedirect::validateConfigurationForm()
Form validation handler.
Parameters
array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().
Overrides PaymentGatewayBase::validateConfigurationForm
File
- src/
Plugin/ Commerce/ PaymentGateway/ WorldpayRedirect.php, line 379
Class
- WorldpayRedirect
- Provides the Worldpay Redirect payment gateway.
Namespace
Drupal\commerce_worldpay\Plugin\Commerce\PaymentGatewayCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::validateConfigurationForm($form, $form_state);
if (!UrlHelper::isValid($form_state
->getValue($form['#parents'])['payment_urls']['live'])) {
$form_state
->setErrorByName('live', $this
->t('The URL @url for @title is invalid. Enter a fully-qualified URL, such as https://secure.worldpay.com/example.', [
'@url' => $form['#value'],
'@title' => $form['#title'],
]));
}
}