Hello I have two custom modules and these modules integrates views module (hook_views_data). But problem is, these modules uses one table that is same to both modules. I dont know How can I use one table for two custom views modules. In the dropdown menu of views, there are custom field groups but my custom modules create this:

Defaults: Add fields
Groups:
----------------------
| <All>              
| Node               
| Comment        
| array                
|      first cust  <---bad it is empy   
|      second cust <---- bad it is empty
-----------------------

When I select 'first cust' (first custom module views) there are no fields and 'second cust' (second custom module views) there are no fields too.

I am sorry, this is support request.

Thank for help M.

Comments

marinex’s picture

Issue summary: View changes

small correct

marinex’s picture

Title: How can I create 2 views modules that describe one table? » How can I create 2 views modules that describe one table?[SOLVED]

It is necessary set property for aliasing table in the hook_views_data:

  $data['custom_table_alias']['table']['join'] = array(
    'node_revisions' => array(
      'left_field' => 'vid',
      'left_table' => 'node_revisions',
      'field' => 'vid',
      'table' => 'custom_table',
    ),
merlinofchaos’s picture

Status: Active » Fixed

It's also possible you'll need to have one of your modules use hook_views_data_alter() rather than hook_views_data() so that it doesn't overwrite the first module's data.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

little correct