Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Feedapi node module do not respect body node settings. I.e. when there is no bidy in content, feedapi node still create body content if there is description field available in the feed.
Simple fix - change (around line# 300):
$node->body = $feed_item->description;
$node->format = isset($settings['input_format']) ? $settings['input_format'] : FILTER_FORMAT_DEFAULT;
$node->teaser = node_teaser($feed_item->description);
to:
if ( db_result(db_query("SELECT has_body FROM {node_type} WHERE type='%s'", $node->type)) == 1 ) {
$node->body = $feed_item->description;
$node->teaser = node_teaser($feed_item->description);
}
$node->format = isset($settings['input_format']) ? $settings['input_format'] : FILTER_FORMAT_DEFAULT;
Unified patch attached
Comment | File | Size | Author |
---|---|---|---|
#4 | feedapi-491594-teaser.patch | 1023 bytes | smartinm |
#1 | 491594_node_fields.patch | 1.04 KB | Aron Novak |
feedapi_node.module.patch | 949 bytes | pavel.karoukin |
Comments
Comment #1
Aron NovakI like the idea, because you can really disable body field, however the solution is suboptimal.
Can you confirm that the patch that I attached just does what you want?
Comment #2
Aron NovakTested, seems to be fine. Committed.
http://drupal.org/cvs?commit=227168
Comment #4
smartinm CreditAttribution: smartinm commentedI think node teaser should not be set if body field is disabled. This is the behavior of Drupal on node_submit():
Simple patch attached.
Comment #5
Aron NovakThank you, committed, makes sense.