开发者

How do I deal with drupal hook_views_tables?

For the title field,I want to return node.title,but what I tried is not workin开发者_如何学运维g:

return array('og' => array('name' => 'og',
            'join' => array('left' => array('table' => 'node',
                    'field' => 'nid'
                    ),
                'right' => array('field' => 'nid'
                    ),
                ),
            'fields' => array(
                'title' => array('name' => t('OG: Group: Group name'),
                    'table' => 'node',
                    'handler' => 'og_handler_field_title',
                    'help' => t('show group name.'),
                    'sortable' => true,
                    'sort_handler' => 'views_og_query_ogname',
                    'notafield' => false,
                    ),


I haven't used views for Drupal 5, so I might be a bit off. But when you make a join on the node, you shouldn't actually need to create the node title field yourself. You should instead be able get it directly from the node table like you would for a normal node.

Your field declarations should only be for the fields you have in the table you want to integrate into views.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜