Many thanks for this great module.

Is there a way to add the Feed title to the list of sources for mapping purposes?

For example, say I have two feeds AM-Radio and FM-Radio, I would like to import the feed into a CCK node type which has an additional text feed to hold AM-Radio or FM-Radio.

Comments

DanielR’s picture

Title: Getting Feed title (not Feed item title) into a CCK field » Feed title as a Source for mapping?

I've made a bit of progress. It seems the best way to use feed item inheritance, rather than mapping.

In FeedsNodeProcessor.inc, function getInheritors(), I added:

    $inheritors['feedtitle'] = array(
      'name' => t('Feed title'),
      'description' => t('The Feed title defined by the user will be copied to a CCK field named feed, if available.'),
      'callback' => 'feeds_inherit_feedtitle',
    );

And then I added the callback function:

function feeds_inherit_feedtitle($item_node, $feed_node) {
  if (!isset($item_node->field_feed) ) {
     $item_node->field_feed = $feed_node->title;
  }
}

This fails with an unusual error message, because I'm using $item_node->field_feed. If I use something else like $item_node->title, it's OK. Can anyone suggest how I might poke the value into a CCK field? Sorry, I'm a total newbie. The error message is below:

An error occurred. /batch?id=21&op=do <br /> <b>Fatal error</b>: Cannot unset string offsets in <b>/var/www/paperfeed.org/sites/all/modules/cck/content.module</b> on line <b>1248</b><br />
(Yes, the html tags show up unrendered)

DanielR’s picture

Title: Feed title as a Source for mapping? » Getting Feed title (not Feed item title) into a CCK field

Changed the name of the issue, to avoid misleading mention of mapping.

DanielR’s picture

Title: Feed title as a Source for mapping? » Getting Feed title (not Feed item title) into a CCK field
Status: Active » Closed (fixed)

Some further progress. The following syntax works for setting the CCK field (see previous comment):
$item_node->field_feed[0]['value'] = $feed_node->title;

Please consider this issue closed as far as I'm concerned.

DanielR’s picture

Priority: Normal » Minor
Status: Closed (fixed) » Active

I'd like to reopen this issue - I still feel it adds a lot of value to the module if feed items can inherit the title of the feed they come from. I think I was incorrect in closing it earlier when I found a workaround.

Sorry if I have overstepped the bounds of etiquette here. I'm very new to drupal.org.

alex_b’s picture

Title: Getting Feed title (not Feed item title) into a CCK field » Using feed title as mapping source (e. g. map to CCK field)

This feature makes sense. I suggest using the mapping API for implementing it. The mapping API is actually designed for item to item mapping, so OTOH, I can't tell whether using feed properties themselves would lead to very nasty code.

alex_b’s picture

Hm - on a second thought, some of the functionality in #632920: Inherit properties from parent feed node (taxonomy, author, OG, language) could be implemented as mapping sources, too. Just a thought.

kenorb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.