简体   繁体   中英

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 working:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM