Skip to content
Snippets Groups Projects
Commit a08c0cd8 authored by Alex Barth's avatar Alex Barth
Browse files

#704236 jerdavis: Support mapping to CCK float field.

parent 29073c00
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
Feeds 6.x 1.0 xxxxxxxxxxxxxxxxxxxx
----------------------------------
- #704236 jerdavis: Support mapping to CCK float field.
- #783820 klonos: Fix warning: copy() [function.copy]: Filename cannot be empty
in FeedsParser.inc on line 168.
- #778416 clemens.tolboom: Better message when plugin is missing.
......
......@@ -16,7 +16,7 @@ function content_feeds_node_processor_targets_alter(&$targets, $content_type) {
$fields = array();
if (isset($info['fields']) && count($info['fields'])) {
foreach ($info['fields'] as $field_name => $field) {
if (in_array($field['type'], array('text', 'number_integer', 'number_decimal'))) {
if (in_array($field['type'], array('text', 'number_integer', 'number_decimal', 'number_float'))) {
$fields[$field_name] = isset($field['widget']['label']) ? $field['widget']['label'] : $field_name;
}
}
......
"guid","title","created","alpha","beta","gamma","body"
1,"Lorem ipsum",1251936720,"Lorem",42,"4.2","Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."
2,"Ut wisi enim ad minim veniam",1251932360,"Ut wisi",32,"1.2","Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat."
"guid","title","created","alpha","beta","gamma","delta","body"
1,"Lorem ipsum",1251936720,"Lorem",42,"4.2",3.14159265,"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."
2,"Ut wisi enim ad minim veniam",1251932360,"Ut wisi",32,"1.2",5.62951413,"Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat."
......@@ -44,11 +44,12 @@ class FeedsMapperContentTestCase extends FeedsMapperTestCase {
*/
function test() {
// Create content type.
$typename = $this->createContentType(NULL, array(
// Create content type.
$typename = $this->createContentType(NULL, array(
'alpha' => 'text',
'beta' => 'number_integer',
'gamma' => 'number_decimal',
'delta' => 'number_float',
));
// Create and configure importer.
......@@ -82,6 +83,10 @@ class FeedsMapperContentTestCase extends FeedsMapperTestCase {
'source' => 'gamma',
'target' => 'field_gamma',
),
array(
'source' => 'delta',
'target' => 'field_delta',
),
));
// Import CSV file.
......@@ -93,10 +98,12 @@ class FeedsMapperContentTestCase extends FeedsMapperTestCase {
$this->assertCCKFieldValue('alpha', 'Lorem');
$this->assertCCKFieldValue('beta', '42');
$this->assertCCKFieldValue('gamma', '4.20');
$this->assertCCKFieldValue('delta', '3.14159');
$this->drupalGet('node/2/edit');
$this->assertCCKFieldValue('alpha', 'Ut wisi');
$this->assertCCKFieldValue('beta', '32');
$this->assertCCKFieldValue('gamma', '1.20');
$this->assertCCKFieldValue('delta', '5.62951');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment