function tripal_remove_views_integration

2.x tripal_views.api.inc tripal_remove_views_integration($identifiers, $options = array())

Removes a View Integration Entry when you only know the table the integration was created for and the priority.

This should only be used to remove integrations created by your own module (possibly on uninstall of your module). To override existing integrations simply create your own integration with a lighter priority using tripal_clone_views_integration() or tripal_export_views_integration() to create a template.

Parameters

$identifies: An array of identifiers where the keys indicate what the identifier is. One of the following compinations must be present: 1) table_name & priority: the name of the table & the priority to remove a views integration entry for 2) setup_id: the setup_id of the entry to remove

$options: An array of options, currently none are supported

Return value

TRUE on Success; FALSE otherwise

Related topics

5 calls to tripal_remove_views_integration()
tripal_phylogeny_uninstall in tripal_phylogeny/tripal_phylogeny.install
Implementation of hook_uninstall().
tripal_update_views_integration in tripal_views/api/tripal_views.api.inc
Update an existing Views Intregration Entry. This essentially removes and then re-adds the integration.
tripal_views_integration_delete in tripal_views/includes/tripal_views_integration_UI.inc
Purpose: Deletes integration of a table with the Views module. This function is meant to be called from a menu item. After completion it redirects the user to the views intergation page.
tripal_views_integration_remove_entry_by_setup_id in tripal_views/api/tripal_views.DEPRECATED.inc
tripal_views_integration_remove_entry_by_table_name in tripal_views/api/tripal_views.DEPRECATED.inc

File

tripal_views/api/tripal_views.api.inc, line 921
API functions for Tripal Views Integration

Code

function tripal_remove_views_integration($identifiers, $options = array()) {

  // Remove the views integration using the table_name/priority combo
  if (isset($identifiers['table_name'])) {
    $table_name = $identifiers['table_name'];
    $priority = $identifiers['priority'];

    $views = db_query(
    "SELECT * FROM {tripal_views} WHERE table_name=:table AND priority=:priority", 
    array(
      ':table' => $table_name,
      ':priority' => $priority
    )
    );
    $views = $views->fetchObject();
    if ($views->setup_id) {
      $identifiers['setup_id'] = $views->setup_id;
    }

  }

  // Remove the views integration using the setup_id
  if (isset($identifiers['setup_id'])) {

    db_query('DELETE FROM {tripal_views} WHERE setup_id=:setup', array(':setup' => $identifiers['setup_id']));
    db_query('DELETE FROM {tripal_views_field} WHERE setup_id=:setup', array(':setup' => $identifiers['setup_id']));
    db_query('DELETE FROM {tripal_views_handlers} WHERE setup_id=:setup', array(':setup' => $identifiers['setup_id']));
    db_query('DELETE FROM {tripal_views_join} WHERE setup_id=:setup', array(':setup' => $identifiers['setup_id']));

    return TRUE;
  }

  return FALSE;
}