FeedAPI Node Views: field "Parent feed" doesn't works

vitali04 - April 8, 2008 - 09:24
Project:FeedAPI
Version:5.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi,
I was working with feedapi module and come upon the bug with "Parent feed" field in Views. This field doesn't display parent node.
This bug was found in feedapi_node_views\feedapi_node_views.module on line 41
'feed_nid' must be replaced on 'feed_item_nid'.
For valid display it is necessary to adding handler for this field

patch:

@@ -38,12 +38,21 @@ function feedapi_node_views_views_tables
'field' => 'nid',
),
'right' => array(
- 'field' => 'feed_nid'
+ 'field' => 'feed_item_nid'
)
),
'fields' => array(
'feed_nid' => array(
- 'name' => t('Parent feed'),
+ 'name' => t('Parent feed'),
+ 'handler' => 'feedapi_node_views_handler_field_feed_nid',
+ 'option' => array(
+ '#type' => 'select',
+ '#options' => array(
+ 'link' => 'As link',
+ 'nolink_to_feeds' => 'As link to feeds',
+ 'nolink' => 'Without link'
+ ),
+ ),
)
),
'filters' => array(
@@ -56,6 +65,17 @@ function feedapi_node_views_views_tables
)
);
return $tables;
+}
+
+function feedapi_node_views_handler_field_feed_nid($fieldinfo, $fielddata, $val
ue, $data) {
+ if(!$node = node_load($value)) return;
+ if ($fielddata['options'] == 'nolink') {
+ return check_plain($node->title);
+ }
+ elseif($fielddata['options'] == 'nolink_to_feeds'){
+ return l($node->title, "feed-item/$node->nid");
+ }
+ return l($node->title, "node/$node->nid");
}

/**

#1

Aron Novak - April 11, 2008 - 19:51
Status:active» fixed

Thanks for the pre-written code lines, it's fixed and committed now: http://drupal.org/cvs?commit=110200
Please grab the next daily dev package to see the results or wait for the next official release.

#2

Anonymous (not verified) - April 25, 2008 - 19:52
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.