function payment_form_embedded_validate in Payment 7
Implements form validate callback for payment_form_embedded().
1 string reference to 'payment_form_embedded_validate'
- payment_form_embedded in ./
payment.ui.inc - Builds common elements for a payment add/edit form.
File
- ./
payment.ui.inc, line 114 - The Payment user interface.
Code
function payment_form_embedded_validate(array $element, array &$form_state, array $form) {
$root_element_parents = array_slice($element['#array_parents'], 0, -1);
$root_element = drupal_array_get_nested_value($form, $root_element_parents);
$payment = $form_state['payment'];
field_attach_form_validate('payment', $payment, $root_element, $form_state);
field_attach_submit('payment', $payment, $root_element, $form_state);
if (empty($form_state['rebuild']) && $payment->method) {
try {
$payment->method
->validate($payment);
} catch (PaymentValidationException $e) {
form_set_error('payment_method', $e
->getMessage());
}
}
}