function locale_feeds_summary_callback in Feeds 7.2
Summary callback.
1 string reference to 'locale_feeds_summary_callback'
- locale_feeds_processor_targets_alter in mappers/
locale.inc - Implements hook_feeds_processor_targets_alter().
File
- mappers/
locale.inc, line 33 - On behalf implementation of Feeds mapping API for locale.module.
Code
function locale_feeds_summary_callback(array $mapping, array $target, array $form, array $form_state) {
$entity_type = $form_state['build_info']['args'][0]->processor
->entityType();
$translatable = _locale_feeds_target_is_translatable($entity_type, $mapping['target']);
$mapping += array(
'field_language' => LANGUAGE_NONE,
);
$language_options = array(
LANGUAGE_NONE => t('Language neutral'),
) + locale_language_list('name');
$error = NULL;
if ($mapping['field_language'] !== LANGUAGE_NONE && !$translatable) {
// This is an invalid configuration that can come from disabling
// entity_translation.
$error = t('Field not translatable');
}
if (!isset($language_options[$mapping['field_language']])) {
// This is an invalid configuration that can be caused by disabling or
// removing the language in question.
$error = t('Language \'@lang\' not available', array(
'@lang' => $mapping['field_language'],
));
}
// Nothing to see here.
if (!$error && !$translatable) {
return;
}
if ($error) {
return t('Language: <strong>Error: @error</strong>', array(
'@error' => $error,
));
}
return t('Language: %lang', array(
'%lang' => $language_options[$mapping['field_language']],
));
}