فهرست منبع

Merge branch '7.x-2.x' of git.drupal.org:sandbox/spficklin/1337878 into 7.x-2.x

Stephen Ficklin 11 سال پیش
والد
کامیت
d63f38a3e8
1فایلهای تغییر یافته به همراه24 افزوده شده و 1 حذف شده
  1. 24 1
      tripal_views/api/tripal_views.api.inc

+ 24 - 1
tripal_views/api/tripal_views.api.inc

@@ -604,7 +604,7 @@ function tripal_views_rebuild_views_integrations($delete_first = FALSE) {
  *
  * @ingroup tripal_views_api
  */
-function tripal_views_integration_add_entry($defn_array) {
+function tripal_views_integration_add_entry($defn_array, $setup_id = FALSE) {
   $no_errors = TRUE;
 
   if (empty($defn_array['table'])) {
@@ -621,6 +621,9 @@ function tripal_views_integration_add_entry($defn_array) {
     'priority' => $defn_array['priority'],
     'base_table' => $defn_array['base_table'],
   );
+  if ($setup_id) {
+    $view_record['setup_id'] = $setup_id;
+  }
   if ($defn_array['type'] == 'mview') {
     // D7 TODO: Check DBTNG changes work
     $mview = db_query("SELECT mview_id FROM {tripal_mviews} WHERE mv_table=:table", array(':table' => $defn_array['table']));
@@ -917,6 +920,26 @@ function tripal_views_integration_remove_entry_by_setup_id($setup_id) {
 
 }
 
+/**
+ * Update an existing Views Intregration Entry.
+ * This essentially removes and then re-adds the integration.
+ *
+ * @param $setup_id
+ *   The setup ID of the views integration entry to update
+ * @param $defn_array
+ *   An array describing the structure and fields of the table as is used in
+ *   tripal_views_integration_add_entry().
+ *
+ * @ingroup tripal_views_api
+ */
+function tripal_views_integration_update_entry($setup_id, $defn_array) {
+
+  tripal_views_integration_remove_entry_by_setup_id($setup_id);
+
+  $defn_array['additional_content'] = TRUE;
+  tripal_views_integration_add_entry($def_array, $setup_id);
+}
+
 /**
  * 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)