I successfully setup a Drupal 6 site to access external databases and present them in tables via Views.
Now I am trying to move to Drupal 7, and I'm not sure how to troubleshoot. In Drupal6, I can open table wizard after editing the settings.php file; it shows the new tables and I can add them.
Is there a way to know if Drupal 7 can see the database? I edited the settings.php file and created a module that is supposed to describe the database to Drupal 7, but I don't see the tables anywhere.
Any suggestions on how to troubleshoot? I don't get any errors or feedback; it simply doesn't do what I want it to do.
This is my code. I have a file called datamodel.module:
function datamodel_views_api() {
return array(
'api' => 2,
'path' => drupal_get_path('module', 'datamodel'),
);
}
I have also a file called datamodel.views.inc. This file is very long but I basically got everything working in drupal6 using table wizards; then I used the table wizards to Views definition for hook_views_data()
, which I put in the following code.
function datamodel_views_data() {
$data = array();
$data['FundManager'] = array(
'FundManager' => array(
'title' => t('FundManager'),
'help' => t('FundManager.FundManager'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_string',
'allow empty' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
'fundManagerCode' => array(
'title' => t('fundManagerCode'),
'help' => t('FundManager.fundManagerCode'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
'allow empty' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
'FundManagerFirm' => array(
'title' => t('FundManagerFirm'),
'help' => t('FundManager.FundManagerFirm'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_string',
'allow empty' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
'FundManagerStartDate' => array(
'title' => t('FundManagerStartDate'),
'help' => t('FundManager.FundManagerStartDate'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_string',
'allow empty' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
'FundManagerDescription' => array(
'title' => t('FundManagerDescription'),
'help' => t('FundManager.FundManagerDescription'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_string',
'allow empty' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
'FundCode' => array(
'title' => t('FundCode'),
'help' => t('FundManager.FundCode'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
'allow empty' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
'table' => array(
'group' => t('FundManager'),
),
);
return $data;
}
I thought I followed the instructions, but nothing happens after I enable the module.