FeedAPI Node Views: field "Parent feed" doesn't works
| Project: | FeedAPI |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
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
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
Automatically closed -- issue fixed for two weeks with no activity.