function feed_import_edit_feed_form_validate in Feed Import 7.2
Same name and namespace in other branches
- 7.3 feed_import.module \feed_import_edit_feed_form_validate()
- 7 feed_import.module \feed_import_edit_feed_form_validate()
Edit feed form validate
File
- ./
feed_import.module, line 1307 - User interface, cron functions for feed_import module
Code
function feed_import_edit_feed_form_validate($form, &$form_state) {
// Cancel button pressed.
$but = isset($form_state['clicked_button']['#parents'][0]) ? $form_state['clicked_button']['#parents'][0] : '';
if ($but == 'cancel') {
drupal_goto(FEED_IMPORT_PATH);
}
// Check settings for procss function.
// These does not show errors.
if (!empty($form_state['values']['settings'])) {
$func = FeedImport::processFunctions();
$func = $func[$form_state['values']['process_function']];
// Prevent fatal errors by checking if function exists.
if (is_array($func['validate'])) {
if (!method_exists($func['validate'][0], $func['validate'][1])) {
return;
}
}
else {
if (empty($func['validate']) || !function_exists($func['validate'])) {
return;
}
}
foreach ($form_state['values']['settings'] as $field => &$value) {
if (isset($func['settings'][$field]['default'])) {
$default = $func['settings'][$field]['default'];
}
else {
$default = NULL;
}
$value = call_user_func($func['validate'], $field, $value, $default);
}
}
else {
$form_state['values']['settings'] = array();
}
}