function tripal_export_views_integration
2.x tripal_views.api.inc | tripal_export_views_integration($setup_id) |
3.x tripal_chado_views.api.inc | tripal_export_views_integration($setup_id) |
Export Views integration records.
This is a great way to create your own integration since it returns an already defined integration in array form that you can modify. After modifications simply set the priority to something lighter (but still below 0) than any existing integrations and use tripal_add_views_integration() to add it to the list of integrations.
Parameters
$setup_id: The unique setup id of the tripal views integration
Return value
A views integration definition array as used by tripal_add_views_integration()
Related topics
3 calls to tripal_export_views_integration()
- tripal_chado_views_integration_export_entry in tripal_chado_views/
api/ tripal_chado_views.DEPRECATED.inc - tripal_chado_views_integration_export_form in tripal_chado_views/
includes/ tripal_chado_views_integration_port.inc - Form: The form to export a particular tripal views integration
- tripal_clone_views_integration in tripal_chado_views/
api/ tripal_chado_views.api.inc - Clone an integration. This is often a great way to create your own module-specific integration while still benifiting from an existing (or even the lightest priority) integration.
1 string reference to 'tripal_export_views_integration'
- tripal_chado_views_integration_export_entry in tripal_chado_views/
api/ tripal_chado_views.DEPRECATED.inc
File
- tripal_chado_views/
api/ tripal_chado_views.api.inc, line 722 - Provides API functions that support direct integration of Chado tables with Drupal Views.
Code
function tripal_export_views_integration($setup_id) {
// Main setup details
// D7 TODO: Check DBTNG changes work
$r = db_query("SELECT * FROM {tripal_views} WHERE setup_id=:setup", array(':setup' => $setup_id));
$r = $r->fetchObject();
$defn_array = array(
'table' => $r->table_name,
'name' => $r->name,
'type' => ($r->mview_id) ? 'mview' : 'chado',
'description' => $r->comment,
'priority' => $r->priority,
'base_table' => $r->base_table,
'fields' => array(),
);
// Add fields.
$resource = db_query("SELECT * FROM {tripal_views_field} WHERE setup_id=:setup", array(':setup' => $setup_id));
foreach ($resource as $r) {
$defn_array['fields'][$r->column_name] = array(
'name' => $r->column_name,
'title' => $r->name,
'description' => $r->description,
'type' => $r->type,
'handlers' => array(),
'joins' => array()
);
}
// Add handlers.
$resource = db_query("SELECT * FROM {tripal_views_handlers} WHERE setup_id=:setup", array(':setup' => $setup_id));
foreach ($resource as $r) {
$defn_array['fields'][$r->column_name]['handlers'][$r->handler_type] = array(
'name' => $r->handler_name
);
}
// Add joins.
$resource = db_query("SELECT * FROM {tripal_views_join} WHERE setup_id=:setup", array(':setup' => $setup_id));
foreach ($resource as $r) {
$defn_array['fields'][$r->base_field]['joins'][$r->left_table][$r->left_field] = array(
'table' => $r->left_table,
'field' => $r->left_field,
'handler' => $r->handler,
);
}
return $defn_array;
}