function feedapi_content_type_validate in FeedAPI 5
Same name and namespace in other branches
- 6 feedapi.module \feedapi_content_type_validate()
Prevent users to use the same weight for two or more parsers and processors because FeedAPI cannot handle this. And this is not neccessary too.
File
- ./
feedapi.module, line 1534 - Handle the submodules (for feed and item processing) Provide a basic management of feeds
Code
function feedapi_content_type_validate($form) {
$parsers = module_implements('feedapi_feed', TRUE);
rsort($parsers);
$processors = module_implements('feedapi_item', TRUE);
rsort($processors);
foreach (array(
'processors',
'parsers',
) as $type) {
$proc_weight = array();
foreach (${$type} as $stuff) {
if (isset($form[$type][$stuff]) && $form[$type][$stuff]['enabled']['#value'] == TRUE) {
if (++$proc_weight[$form[$type][$stuff]['weight']['#value']] > 1) {
form_error($form, t('Two enabled processors or parsers cannot have the same weight.'), 'error');
}
}
}
}
}