Browse Source

Added the ability to disable the admin message indicating where a template is housed. We don't want users to edit the bulk loader templates

Stephen Ficklin 11 years ago
parent
commit
c1f5b44364

+ 2 - 0
tripal_bulk_loader/includes/tripal_bulk_loader.chado_node.inc

@@ -384,12 +384,14 @@ function tripal_bulk_loader_node_view($node, $view_mode, $langcode) {
           '#markup' => theme('tripal_bulk_loader_base', array('node' => $node)),
           '#tripal_toc_id'    => 'base',
           '#tripal_toc_title' => 'Overview',
+          '#tripal_template_show' => FALSE, 
           '#weight' => -100,
         );
         $node->content['tripal_bulk_loader_fields'] = array(
           '#markup' => theme('tripal_bulk_loader_fields', array('node' => $node)),
           '#tripal_toc_id'    => 'fields',
           '#tripal_toc_title' => 'Data Fields',
+          '#tripal_template_show' => FALSE,
         );
       }
       if ($view_mode == 'teaser') {

+ 16 - 13
tripal_core/tripal_core.module

@@ -618,19 +618,22 @@ function tripal_core_node_view_alter(&$build) {
         //-----------------------
         // get the template path so we can put it in an admin message box
         $path = '';
-        if ($cache and array_key_exists($key, $cache->data) and array_key_exists('path', $cache->data[$key])) {
-
-          $path = $cache->data[$key]['path'] . '/' . $key . '.tpl.php';
-
-          $path = tripal_set_message("Administrators, you can
-            customize the way the content above is presented.  Tripal provides a template
-            file for each block of content.  To customize, copy the template file to your
-            site's default theme, edit then " .
-            l('clear the Drupal cache', 'admin/config/development/performance', array('attributes' => array('target' => '_blank'))) . ".
-            Currently, the content above is provided by this template: <br><br>$path",
-            TRIPAL_INFO,
-            array('return_html' => 1)
-          );
+        if (!array_key_exists('#tripal_template_show', $build[$key]) or 
+             $build[$key]['#tripal_template_show'] == TRUE) {
+          if ($cache and array_key_exists($key, $cache->data) and array_key_exists('path', $cache->data[$key])) {
+  
+            $path = $cache->data[$key]['path'] . '/' . $key . '.tpl.php';
+  
+            $path = tripal_set_message("Administrators, you can
+              customize the way the content above is presented.  Tripal provides a template
+              file for each block of content.  To customize, copy the template file to your
+              site's default theme, edit then " .
+              l('clear the Drupal cache', 'admin/config/development/performance', array('attributes' => array('target' => '_blank'))) . ".
+              Currently, the content above is provided by this template: <br><br>$path",
+              TRIPAL_INFO,
+              array('return_html' => 1)
+            );
+          }
         }
 
         //-----------------------

+ 6 - 0
tripal_example/includes/tripal_example.chado_node.inc

@@ -777,6 +777,12 @@ function tripal_example_node_view($node, $view_mode, $langcode) {
           '#tripal_toc_id'    => 'relationships',
           '#tripal_toc_title' => 'Relationships',
         );
+        
+        // Note: if you create a template that you do not want a user to 
+        // know where it is (discourage editing of it), you can add the following 
+        // key:  '#tripal_template_show' => FALSE. If this key/value is set
+        // the the administrator message that Tripal provides indicating
+        // where the template is housed will not be shown.
       }
       // set the content for the teaser view
       if ($view_mode == 'teaser') {