public function TaxonomyImporter::formValidate
3.x TaxonomyImporter.inc | public TaxonomyImporter::formValidate($form, &$form_state) |
Overrides TripalImporter::formValidate
See also
TripalImporter::formValidate()
File
- tripal_chado/
includes/ TripalImporter/ TaxonomyImporter.inc, line 157
Class
Code
public function formValidate($form, &$form_state) {
global $user;
$import_existing = $form_state['values']['import_existing'];
$taxonomy_ids = $form_state['values']['taxonomy_ids'];
// make sure that we have numeric values, one per line.
if ($taxonomy_ids) {
$tax_ids = preg_split("/[\s\n\t\r]+/", $taxonomy_ids);
$bad_ids = array();
foreach ($tax_ids as $tax_id) {
$tax_id = trim($tax_id);
if (!preg_match('/^\d+$/', $tax_id)) {
$bad_ids[] = $tax_id;
}
}
if (count($bad_ids) > 0) {
form_set_error('taxonomy_ids',
t('Taxonomy IDs must be numeric. The following are not valid: "@ids".',
array('@ids' => implode('", "', $bad_ids))));
}
}
}