function text_feeds_form_callback in Feeds 7.2
Form callback for text field targets.
Allows to select a text format for the text field target.
See also
text_feeds_processor_targets()
2 string references to 'text_feeds_form_callback'
- FeedsTermProcessor::getMappingTargets in plugins/
FeedsTermProcessor.inc - Return available mapping targets.
- text_feeds_processor_targets in mappers/
text.inc - Implements hook_feeds_processor_targets().
File
- mappers/
text.inc, line 119 - On behalf implementation of Feeds mapping API for text.module.
Code
function text_feeds_form_callback(array $mapping, $target, array $form, array $form_state) {
global $user;
$formats_options = array();
$formats = filter_formats($user);
foreach ($formats as $id => $format) {
$formats_options[$id] = $format->name;
}
// Processor-wide text format setting.
$importer = feeds_importer($form['#importer']);
$default_format = !empty($importer->processor->config['input_format']) ? $importer->processor->config['input_format'] : filter_fallback_format();
$mapping += array(
'format' => $default_format,
);
return array(
'format' => array(
'#type' => 'select',
'#title' => t('Text format'),
'#options' => $formats_options,
'#default_value' => $mapping['format'],
),
);
}