function tmgmt_cart_source_overview_validate in Translation Management Tool 8
Cart form validation callback for the source overview.
Related topics
1 call to tmgmt_cart_source_overview_validate()
- SourceOverviewForm::validateItemsSelected in src/
Form/ SourceOverviewForm.php - Validation for selected items.
2 string references to 'tmgmt_cart_source_overview_validate'
- CartForm::buildForm in src/
Form/ CartForm.php - Form constructor.
- tmgmt_add_cart_form in ./
tmgmt.module - Adds add to cart form elements.
File
- ./
tmgmt.module, line 1268 - Main module file for the Translation Management module.
Code
function tmgmt_cart_source_overview_validate(array $form, FormStateInterface $form_state) {
$items = array_filter($form_state
->getValue('items'));
if (empty($items)) {
$form_state
->setError($form, t("You didn't select any source items."));
}
}