Browse Source

run phpstorm base style formatter

bradfordcondon 6 years ago
parent
commit
5a8103068a
100 changed files with 6568 additions and 5925 deletions
  1. 68 65
      legacy/tripal_analysis/api/tripal_analysis.DEPRECATED.inc
  2. 26 21
      legacy/tripal_analysis/includes/tripal_analysis.admin.inc
  3. 193 186
      legacy/tripal_analysis/includes/tripal_analysis.chado_node.inc
  4. 33 34
      legacy/tripal_analysis/includes/tripal_analysis.delete.inc
  5. 27 15
      legacy/tripal_analysis/includes/tripal_analysis_privacy.inc
  6. 48 48
      legacy/tripal_analysis/theme/templates/tripal_analysis_base.tpl.php
  7. 45 24
      legacy/tripal_analysis/theme/templates/tripal_analysis_help.tpl.php
  8. 19 17
      legacy/tripal_analysis/theme/templates/tripal_analysis_properties.tpl.php
  9. 11 11
      legacy/tripal_analysis/theme/templates/tripal_analysis_teaser.tpl.php
  10. 25 25
      legacy/tripal_analysis/tripal_analysis.views_default.inc
  11. 62 61
      legacy/tripal_contact/api/tripal_contact.DEPRECATED.inc
  12. 24 22
      legacy/tripal_contact/includes/tripal_contact.admin.inc
  13. 174 158
      legacy/tripal_contact/includes/tripal_contact.chado_node.inc
  14. 24 24
      legacy/tripal_contact/theme/templates/tripal_contact_base.tpl.php
  15. 39 19
      legacy/tripal_contact/theme/templates/tripal_contact_help.tpl.php
  16. 24 22
      legacy/tripal_contact/theme/templates/tripal_contact_properties.tpl.php
  17. 40 35
      legacy/tripal_contact/theme/templates/tripal_contact_publications.tpl.php
  18. 103 97
      legacy/tripal_contact/theme/templates/tripal_contact_relationships.tpl.php
  19. 15 15
      legacy/tripal_contact/theme/templates/tripal_contact_teaser.tpl.php
  20. 23 23
      legacy/tripal_contact/theme/tripal_contact.theme.inc
  21. 33 33
      legacy/tripal_contact/tripal_contact.views_default.inc
  22. 241 232
      legacy/tripal_core/api/tripal_core.DEPRECATED.inc
  23. 281 265
      legacy/tripal_core/api/tripal_core.chado_nodes.api.inc
  24. 278 252
      legacy/tripal_core/api/tripal_core.chado_nodes.dbxrefs.api.inc
  25. 312 285
      legacy/tripal_core/api/tripal_core.chado_nodes.properties.api.inc
  26. 330 299
      legacy/tripal_core/api/tripal_core.chado_nodes.relationships.api.inc
  27. 340 302
      legacy/tripal_core/api/tripal_core.chado_nodes.title_and_path.inc
  28. 9 8
      legacy/tripal_core/api/tripal_core.tripal_variables.api.inc
  29. 39 39
      legacy/tripal_core/includes/tripal_core.form_elements.inc
  30. 87 71
      legacy/tripal_core/includes/tripal_core.search.inc
  31. 103 104
      legacy/tripal_core/includes/tripal_core.toc.inc
  32. 64 60
      legacy/tripal_core/theme/templates/node--chado-generic.tpl.php
  33. 5 3
      legacy/tripal_core/theme/templates/tripal_core_jobs_help.tpl.php
  34. 5 3
      legacy/tripal_core/theme/templates/tripal_core_mviews_help.tpl.php
  35. 84 84
      legacy/tripal_core/tripal_core.drush.inc
  36. 9 9
      legacy/tripal_core/tripal_core.views_default.inc
  37. 112 111
      legacy/tripal_cv/api/tripal_cv.DEPRECATED.inc
  38. 25 22
      legacy/tripal_cv/api/tripal_cv.api.inc
  39. 96 96
      legacy/tripal_cv/includes/tripal_cv.cv_defaults.inc
  40. 54 34
      legacy/tripal_cv/theme/templates/tripal_cv_help.tpl.php
  41. 1 1
      legacy/tripal_cv/tripal_cv.views_default.inc
  42. 74 74
      legacy/tripal_db/api/tripal_db.DEPRECATED.inc
  43. 38 20
      legacy/tripal_db/theme/templates/tripal_db_help.tpl.php
  44. 1 2
      legacy/tripal_db/tripal_db.views_default.inc
  45. 184 182
      legacy/tripal_feature/api/tripal_feature.DEPRECATED.inc
  46. 72 70
      legacy/tripal_feature/includes/tripal_feature.admin.inc
  47. 290 249
      legacy/tripal_feature/includes/tripal_feature.chado_node.inc
  48. 44 45
      legacy/tripal_feature/includes/tripal_feature.delete.inc
  49. 32 30
      legacy/tripal_feature/theme/templates/tripal_feature_alignments.tpl.php
  50. 23 20
      legacy/tripal_feature/theme/templates/tripal_feature_analyses.tpl.php
  51. 15 9
      legacy/tripal_feature/theme/templates/tripal_feature_bar_chart_type_organism_summary.tpl.php
  52. 55 55
      legacy/tripal_feature/theme/templates/tripal_feature_base.tpl.php
  53. 207 121
      legacy/tripal_feature/theme/templates/tripal_feature_help.tpl.php
  54. 24 24
      legacy/tripal_feature/theme/templates/tripal_feature_properties.tpl.php
  55. 40 35
      legacy/tripal_feature/theme/templates/tripal_feature_publications.tpl.php
  56. 40 39
      legacy/tripal_feature/theme/templates/tripal_feature_references.tpl.php
  57. 124 107
      legacy/tripal_feature/theme/templates/tripal_feature_relationships.tpl.php
  58. 38 32
      legacy/tripal_feature/theme/templates/tripal_feature_sequence.tpl.php
  59. 23 21
      legacy/tripal_feature/theme/templates/tripal_feature_synonyms.tpl.php
  60. 8 8
      legacy/tripal_feature/theme/templates/tripal_feature_teaser.tpl.php
  61. 20 17
      legacy/tripal_feature/theme/templates/tripal_feature_terms.tpl.php
  62. 49 46
      legacy/tripal_feature/theme/templates/tripal_organism_feature_browser.tpl.php
  63. 20 18
      legacy/tripal_feature/theme/templates/tripal_organism_feature_counts.tpl.php
  64. 154 133
      legacy/tripal_feature/theme/tripal_feature.theme.inc
  65. 45 45
      legacy/tripal_feature/tripal_feature.drush.inc
  66. 9 9
      legacy/tripal_feature/tripal_feature.views.inc
  67. 82 82
      legacy/tripal_feature/tripal_feature.views_default.inc
  68. 4 1
      legacy/tripal_feature/views_handlers/views_handler_field_residues.inc
  69. 70 69
      legacy/tripal_featuremap/api/tripal_featuremap.DEPRECATED.inc
  70. 22 20
      legacy/tripal_featuremap/includes/tripal_featuremap.admin.inc
  71. 149 133
      legacy/tripal_featuremap/includes/tripal_featuremap.chado_node.inc
  72. 49 47
      legacy/tripal_featuremap/theme/templates/tripal_feature_featurepos.tpl.php
  73. 28 28
      legacy/tripal_featuremap/theme/templates/tripal_featuremap_base.tpl.php
  74. 64 55
      legacy/tripal_featuremap/theme/templates/tripal_featuremap_featurepos.tpl.php
  75. 46 25
      legacy/tripal_featuremap/theme/templates/tripal_featuremap_help.tpl.php
  76. 15 15
      legacy/tripal_featuremap/theme/templates/tripal_featuremap_properties.tpl.php
  77. 29 24
      legacy/tripal_featuremap/theme/templates/tripal_featuremap_publication.tpl.php
  78. 35 33
      legacy/tripal_featuremap/theme/templates/tripal_featuremap_references.tpl.php
  79. 11 11
      legacy/tripal_featuremap/theme/templates/tripal_featuremap_teaser.tpl.php
  80. 47 47
      legacy/tripal_featuremap/tripal_featuremap.views_default.inc
  81. 3 3
      legacy/tripal_genetic/includes/tripal_genetic.admin.inc
  82. 43 41
      legacy/tripal_genetic/theme/templates/tripal_feature_genotypes.tpl.php
  83. 47 44
      legacy/tripal_genetic/theme/templates/tripal_stock_genotypes.tpl.php
  84. 18 18
      legacy/tripal_genetic/tripal_genetic.views_default.inc
  85. 47 46
      legacy/tripal_library/api/tripal_library.DEPRECATED.inc
  86. 22 20
      legacy/tripal_library/includes/tripal_library.admin.inc
  87. 195 175
      legacy/tripal_library/includes/tripal_library.chado_node.inc
  88. 30 26
      legacy/tripal_library/theme/templates/tripal_feature_libraries.tpl.php
  89. 49 49
      legacy/tripal_library/theme/templates/tripal_library_base.tpl.php
  90. 39 36
      legacy/tripal_library/theme/templates/tripal_library_features.tpl.php
  91. 35 17
      legacy/tripal_library/theme/templates/tripal_library_help.tpl.php
  92. 20 20
      legacy/tripal_library/theme/templates/tripal_library_properties.tpl.php
  93. 39 34
      legacy/tripal_library/theme/templates/tripal_library_publications.tpl.php
  94. 34 33
      legacy/tripal_library/theme/templates/tripal_library_references.tpl.php
  95. 23 21
      legacy/tripal_library/theme/templates/tripal_library_synonyms.tpl.php
  96. 17 17
      legacy/tripal_library/theme/templates/tripal_library_teaser.tpl.php
  97. 28 25
      legacy/tripal_library/theme/templates/tripal_library_terms.tpl.php
  98. 30 26
      legacy/tripal_library/theme/templates/tripal_organism_libraries.tpl.php
  99. 35 35
      legacy/tripal_library/tripal_library.views_default.inc
  100. 3 3
      legacy/tripal_natural_diversity/includes/tripal_natural_diversity.admin.inc

+ 68 - 65
legacy/tripal_analysis/api/tripal_analysis.DEPRECATED.inc

@@ -1,13 +1,14 @@
 <?php
 /**
  * @file
- * Wrapper functions to provide backwards compatibility for the tripal analysis api
+ * Wrapper functions to provide backwards compatibility for the tripal analysis
+ *   api
  */
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_register_analysis_child().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_register_analysis_child().
  *
  * @see tripal_register_analysis_child().
  */
@@ -17,10 +18,10 @@ function tripal_analysis_register_child($modulename) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_analysis_register_child',
-      '%new_function' => 'tripal_register_analysis_child'
-    )
+    [
+      '%old_function' => 'tripal_analysis_register_child',
+      '%new_function' => 'tripal_register_analysis_child',
+    ]
   );
 
   return tripal_register_analysis_child($modulename);
@@ -28,8 +29,9 @@ function tripal_analysis_register_child($modulename) {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_unregister_analysis_child().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by
+ *   tripal_unregister_analysis_child().
  *
  * @see tripal_unregister_analysis_child().
  */
@@ -39,10 +41,10 @@ function tripal_analysis_unregister_child($modulename) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_analysis_unregister_child',
-      '%new_function' => 'tripal_unregister_analysis_child'
-    )
+    [
+      '%old_function' => 'tripal_analysis_unregister_child',
+      '%new_function' => 'tripal_unregister_analysis_child',
+    ]
   );
 
   return tripal_unregister_analysis_child($modulename);
@@ -50,8 +52,8 @@ function tripal_analysis_unregister_child($modulename) {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_get_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_get_property().
  *
  * @see chado_get_property().
  */
@@ -61,28 +63,28 @@ function tripal_analysis_get_property($analysis_id, $property, $cv_name = 'tripa
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_analysis_get_property',
-      '%new_function' => 'chado_get_property'
-    )
+    [
+      '%old_function' => 'tripal_analysis_get_property',
+      '%new_function' => 'chado_get_property',
+    ]
   );
-  
-  $record = array(
+
+  $record = [
     'table' => 'analysis',
     'id' => $analysis_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
-  );
+  ];
 
   return chado_get_property($record, $property);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_insert_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_insert_property().
  *
  * @see chado_insert_property().
  */
@@ -92,31 +94,31 @@ function tripal_analysis_insert_property($analysis_id, $property, $value, $updat
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_analysis_insert_property',
-      '%new_function' => 'chado_insert_property'
-    )
+    [
+      '%old_function' => 'tripal_analysis_insert_property',
+      '%new_function' => 'chado_insert_property',
+    ]
   );
 
-  $record = array(
+  $record = [
     'table' => 'analysis',
     'id' => $analysis_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
     'value' => $value,
-  );
-  $options = array(
+  ];
+  $options = [
     'update_if_present' => $update_if_present,
-  );
+  ];
   return chado_insert_property($record, $property, $options);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_update_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_update_property().
  *
  * @see chado_update_property().
  */
@@ -126,31 +128,32 @@ function tripal_analysis_update_property($analysis_id, $property, $value, $inser
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_analysis_update_property',
-      '%new_function' => 'chado_update_property'
-    )
+    [
+      '%old_function' => 'tripal_analysis_update_property',
+      '%new_function' => 'chado_update_property',
+    ]
   );
 
-  $record = array(
+  $record = [
     'table' => 'analysis',
     'id' => $analysis_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
     'value' => $value,
-  );
-  $options = array(
+  ];
+  $options = [
     'insert_if_missing' => $insert_if_missing,
-  );
+  ];
   return chado_update_property($record, $property, $options);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by the more generic chado_delete_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by the more generic
+ *   chado_delete_property().
  *
  * @see chado_delete_property().
  */
@@ -158,26 +161,26 @@ function tripal_analysis_delete_property($analysis_id, $property, $cv_name = 'tr
 
   tripal_report_error('tripal_deprecated', TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_analysis_delete_property',
-      '%new_function' => 'chado_delete_property'
-    )
+    [
+      '%old_function' => 'tripal_analysis_delete_property',
+      '%new_function' => 'chado_delete_property',
+    ]
   );
-  $record = array(
+  $record = [
     'table' => 'analysis',
     'id' => $analysis_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
-  );
+  ];
   return chado_delete_property($record, $property);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_analysis().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_analysis().
  *
  * @see tripal_get_analysis().
  */
@@ -187,11 +190,11 @@ function tripal_analysis_get_node($analysis_id) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_analysis_get_node',
-      '%new_function' => 'tripal_get_analysis'
-    )
+    [
+      '%old_function' => 'tripal_analysis_get_node',
+      '%new_function' => 'tripal_get_analysis',
+    ]
   );
 
-  return tripal_get_analysis(array('analysis_id' => $analysis_id));
+  return tripal_get_analysis(['analysis_id' => $analysis_id]);
 }

+ 26 - 21
legacy/tripal_analysis/includes/tripal_analysis.admin.inc

@@ -8,7 +8,8 @@
  */
 
 /**
- * Landing page for administration. Ensures Views are enabled & if not provides links to do so.
+ * Landing page for administration. Ensures Views are enabled & if not provides
+ * links to do so.
  *
  * @ingroup tripal_legacy_analysis
  */
@@ -16,7 +17,7 @@ function tripal_analysis_admin_analysis_view() {
   $output = '';
 
   // set the breadcrumb
-  $breadcrumb = array();
+  $breadcrumb = [];
   $breadcrumb[] = l('Home', '<front>');
   $breadcrumb[] = l('Administration', 'admin');
   $breadcrumb[] = l('Tripal', 'admin/tripal');
@@ -25,7 +26,7 @@ function tripal_analysis_admin_analysis_view() {
   drupal_set_breadcrumb($breadcrumb);
 
   // Add the view
-  $view = views_embed_view('tripal_analysis_admin_analyses','default');
+  $view = views_embed_view('tripal_analysis_admin_analyses', 'default');
   if (isset($view)) {
     $output .= $view;
   }
@@ -35,7 +36,7 @@ function tripal_analysis_admin_analysis_view() {
       . 'administrative interface are disabled. <strong>Click each of the following links to '
       . 'enable the pertinent views</strong>:</p>';
     $output .= '<ul>';
-      $output .= '<li>'.l('Analysis View', 'admin/tripal/legacy/tripal_analysis/views/analyses/enable').'</li>';
+    $output .= '<li>' . l('Analysis View', 'admin/tripal/legacy/tripal_analysis/views/analyses/enable') . '</li>';
     $output .= '</ul>';
   }
 
@@ -54,36 +55,38 @@ function tripal_analysis_admin() {
   // Create a new administrative form. We'll add main functions to the form
   // first (Sync, Reindex, Clean, Taxonify). Thereafter, any sub-module that
   // has a setting will be added.
-  $form = array();
+  $form = [];
 
   // If your module is using the Chado Node: Title & Path API to allow custom titles
   // for your node type then you need to add the configuration form for this functionality.
-  $details = array(
-    'module' => 'tripal_analysis',       // the name of the MODULE implementing the content type
-    'content_type' => 'chado_analysis',   // the name of the content type
-      // An array of options to use under "Page Titles"
-      // the key should be the token and the value should be the human-readable option
-    'options' => array(
+  $details = [
+    'module' => 'tripal_analysis',
+    // the name of the MODULE implementing the content type
+    'content_type' => 'chado_analysis',
+    // the name of the content type
+    // An array of options to use under "Page Titles"
+    // the key should be the token and the value should be the human-readable option
+    'options' => [
       '[analysis.name]' => 'Analysis Name Only',
-        // there should always be one options matching the unique constraint.
-      '[analysis.name] ([analysis.sourcename]) [analysis.program] version [analysis.programversion]' => 'Unique Contraint: Includes the name, source and program name/version'
-    ),
+      // there should always be one options matching the unique constraint.
+      '[analysis.name] ([analysis.sourcename]) [analysis.program] version [analysis.programversion]' => 'Unique Contraint: Includes the name, source and program name/version',
+    ],
     // the token indicating the unique constraint in the options array
-    'unique_option' => '[analysis.name] ([analysis.sourcename]) [analysis.program] version [analysis.programversion]'
-  );
+    'unique_option' => '[analysis.name] ([analysis.sourcename]) [analysis.program] version [analysis.programversion]',
+  ];
   // This call adds the configuration form to your current form
   // This sub-form handles it's own validation & submit
   chado_add_admin_form_set_title($form, $form_state, $details);
 
   // URL ALIAS
-  $details = array(
+  $details = [
     'module' => 'tripal_analysis',
     'content_type' => 'chado_analysis',
-    'options' => array(
+    'options' => [
       '/analysis/[analysis.analysis_id]' => 'Analysis ID',
-      '/analysis/[analysis.program]/[analysis.programversion]/[analysis.sourcename]' => 'Unique Contraint: Includes the program name & version as well as the source name'
-    ),
-  );
+      '/analysis/[analysis.program]/[analysis.programversion]/[analysis.sourcename]' => 'Unique Contraint: Includes the program name & version as well as the source name',
+    ],
+  ];
 
   // This call adds the configuration form to your current form
   // This sub-form handles it's own validation & submit
@@ -94,10 +97,12 @@ function tripal_analysis_admin() {
 
 /**
  * Validate the administrative form
+ *
  * @todo Stephen: Why is validate used rather then submit?
  *
  * @param $form
  *   The form API array of the form to be validated
+ *
  * @form_state
  *   The user submitted values
  *

+ 193 - 186
legacy/tripal_analysis/includes/tripal_analysis.chado_node.inc

@@ -15,27 +15,27 @@
  * @ingroup tripal_legacy_analysis
  */
 function tripal_analysis_node_info() {
-  $nodes = array();
-  $nodes['chado_analysis'] = array(
-    'name'        => t('Analysis (Tripal v2 legacy)'),
-    'base'        => 'chado_analysis',
+  $nodes = [];
+  $nodes['chado_analysis'] = [
+    'name' => t('Analysis (Tripal v2 legacy)'),
+    'base' => 'chado_analysis',
     'description' => t('An analysis'),
-    'has_title'   => TRUE,
-    'locked'      => TRUE,
-    'chado_node_api' => array(
+    'has_title' => TRUE,
+    'locked' => TRUE,
+    'chado_node_api' => [
       'base_table' => 'analysis',
       'hook_prefix' => 'chado_analysis',
-      'record_type_title' => array(
+      'record_type_title' => [
         'singular' => t('Analysis'),
-        'plural' => t('Analyses')
-      ),
-      'sync_filters' => array(
+        'plural' => t('Analyses'),
+      ],
+      'sync_filters' => [
         'type_id' => FALSE,
         'organism_id' => FALSE,
-        'checkboxes' => array('name'),
-      ),
-    )
-  );
+        'checkboxes' => ['name'],
+      ],
+    ],
+  ];
   return $nodes;
 }
 
@@ -51,6 +51,7 @@ function chado_analysis_chado_node_sync_form($form, &$form_state) {
   }
   return $form;
 }
+
 /**
  * Implements hook_form().
  * When editing or creating a new node of type 'chado_analysis' we need
@@ -59,7 +60,7 @@ function chado_analysis_chado_node_sync_form($form, &$form_state) {
  * @ingroup tripal_legacy_analysis
  */
 function chado_analysis_form($node, &$form_state) {
-  $form = array();
+  $form = [];
 
   // Default values can come in the following ways:
   //
@@ -70,18 +71,18 @@ function chado_analysis_form($node, &$form_state) {
   //    form elements and the form is being rebuilt
   //
   // set form field defaults
-  $analysis_id    = null;
-  $analysisname   = '';
-  $program        = '';
+  $analysis_id = NULL;
+  $analysisname = '';
+  $program = '';
   $programversion = '';
-  $algorithm      = '';
-  $sourcename     = '';
-  $sourceversion  = '';
-  $sourceuri      = '';
-  $timeexecuted   = '';
-  $description    = '';
-  $d_removed      = array(); // lists removed properties
-  $num_new        = 0;  // the number of new rows
+  $algorithm = '';
+  $sourcename = '';
+  $sourceversion = '';
+  $sourceuri = '';
+  $timeexecuted = '';
+  $description = '';
+  $d_removed = []; // lists removed properties
+  $num_new = 0;  // the number of new rows
 
   // if we are editing an existing node then the analysis is already part of the node
   if (property_exists($node, 'analysis')) {
@@ -90,62 +91,62 @@ function chado_analysis_form($node, &$form_state) {
     $analysis_id = $analysis->analysis_id;
 
     // get form defaults
-    $analysisname   = $analysis->name;
-    $program        = $analysis->program;
+    $analysisname = $analysis->name;
+    $program = $analysis->program;
     $programversion = $analysis->programversion;
-    $algorithm      = $analysis->algorithm;
-    $sourcename     = $analysis->sourcename;
-    $sourceversion  = $analysis->sourceversion;
-    $sourceuri      = $analysis->sourceuri;
-    $timeexecuted   = $analysis->timeexecuted;
-    $description    = $analysis->description;
-    $analysis_type  = $node->type;
+    $algorithm = $analysis->algorithm;
+    $sourcename = $analysis->sourcename;
+    $sourceversion = $analysis->sourceversion;
+    $sourceuri = $analysis->sourceuri;
+    $timeexecuted = $analysis->timeexecuted;
+    $description = $analysis->description;
+    $analysis_type = $node->type;
 
 
     // set the analysis_id in the form
-    $form['analysis_id'] = array(
+    $form['analysis_id'] = [
       '#type' => 'value',
       '#value' => $analysis->analysis_id,
-    );
+    ];
   }
   // if we are re constructing the form from a failed validation or ajax callback
   // then use the $form_state['values'] values
   if (array_key_exists('values', $form_state)) {
-    $analysisname   = $form_state['values']['analysisname'];
-    $program        = $form_state['values']['program'];
+    $analysisname = $form_state['values']['analysisname'];
+    $program = $form_state['values']['program'];
     $programversion = $form_state['values']['programversion'];
-    $algorithm      = $form_state['values']['algorithm'];
-    $sourcename     = $form_state['values']['sourcename'];
-    $sourceversion  = $form_state['values']['sourceversion'];
-    $sourceuri      = $form_state['values']['sourceuri'];
-    $timeexecuted   = $form_state['values']['timeexecuted'];
-    $description    = $form_state['values']['description'];
-    $d_removed      = $form_state['values']['removed'];
-    $num_new        = $form_state['values']['num_new'] ? $form_state['values']['num_new'] : 0;
-    $analysis_type  = $form_state['values']['analysis_type'];
+    $algorithm = $form_state['values']['algorithm'];
+    $sourcename = $form_state['values']['sourcename'];
+    $sourceversion = $form_state['values']['sourceversion'];
+    $sourceuri = $form_state['values']['sourceuri'];
+    $timeexecuted = $form_state['values']['timeexecuted'];
+    $description = $form_state['values']['description'];
+    $d_removed = $form_state['values']['removed'];
+    $num_new = $form_state['values']['num_new'] ? $form_state['values']['num_new'] : 0;
+    $analysis_type = $form_state['values']['analysis_type'];
   }
   // if we are re building the form from after submission (from ajax call) then
   // the values are in the $form_state['input'] array
   if (array_key_exists('input', $form_state) and !empty($form_state['input'])) {
-    $analysisname   = $form_state['input']['analysisname'];
-    $program        = $form_state['input']['program'];
+    $analysisname = $form_state['input']['analysisname'];
+    $program = $form_state['input']['program'];
     $programversion = $form_state['input']['programversion'];
-    $algorithm      = $form_state['input']['algorithm'];
-    $sourcename     = $form_state['input']['sourcename'];
-    $sourceversion  = $form_state['input']['sourceversion'];
-    $sourceuri      = $form_state['input']['sourceuri'];
-    $timeexecuted   = $form_state['input']['timeexecuted'];
-    $description    = $form_state['input']['description'];
-    $d_removed      = isset($form_state['input']['removed']) ? $form_state['input']['removed'] : array();
-    $num_new        = isset($form_state['input']['num_new']) ? $form_state['input']['num_new'] : 0;
-    $analysis_type  = isset($form_state['input']['analysis_type']) ? $form_state['input']['analysis_type'] : '';
+    $algorithm = $form_state['input']['algorithm'];
+    $sourcename = $form_state['input']['sourcename'];
+    $sourceversion = $form_state['input']['sourceversion'];
+    $sourceuri = $form_state['input']['sourceuri'];
+    $timeexecuted = $form_state['input']['timeexecuted'];
+    $description = $form_state['input']['description'];
+    $d_removed = isset($form_state['input']['removed']) ? $form_state['input']['removed'] : [];
+    $num_new = isset($form_state['input']['num_new']) ? $form_state['input']['num_new'] : 0;
+    $analysis_type = isset($form_state['input']['analysis_type']) ? $form_state['input']['analysis_type'] : '';
   }
 
-  $form['title']= array(
+  $form['title'] = [
     '#type' => 'value',
     '#default_value' => $node->title,
-  );
-  $form['instructions'] = array(
+  ];
+  $form['instructions'] = [
     '#markup' => t('When adding any type of data it is good to associate it with
         an analysis so that site visitors can identify the source of the data including
         necessary materials and methods.  The fields below imply that all analyses
@@ -153,52 +154,52 @@ function chado_analysis_form($node, &$form_state) {
         from an external source or an analysis pipeline with multipel software components.
         In these cases, provide values for the fields below that best makes sense
      '),
-  );
-  $form['analysisname']= array(
+  ];
+  $form['analysisname'] = [
     '#type' => 'textfield',
     '#title' => t('Analysis Name'),
     '#required' => TRUE,
     '#default_value' => $analysisname,
     '#description' => t("This should be a brief name that
        describes the analysis succintly. This name will helps the user find analyses."),
-  );
-  $form['program']= array(
+  ];
+  $form['program'] = [
     '#type' => 'textfield',
     '#title' => t('Program, Pipeline Name or Method Name'),
     '#required' => TRUE,
     '#default_value' => $program,
     '#description' => t("Program name, e.g. blastx, blastp, sim4, genscan. If the analysis was not derived from a software package, provide a very brief description of the pipeline or method."),
-  );
-  $form['programversion']= array(
+  ];
+  $form['programversion'] = [
     '#type' => 'textfield',
     '#title' => t('Program, Pipeline  or Method Version'),
     '#required' => TRUE,
     '#default_value' => $programversion,
     '#description' => t("Version description, e.g. TBLASTX 2.0MP-WashU [09-Nov-2000]. Enter 'n/a' if no version is available or applicable."),
-  );
-  $form['algorithm']= array(
+  ];
+  $form['algorithm'] = [
     '#type' => 'textfield',
     '#title' => t('Algorithm'),
     '#required' => FALSE,
     '#default_value' => $algorithm,
     '#description' => t("Algorithm name, e.g. blast."),
-  );
-  $form['sourcename']= array(
+  ];
+  $form['sourcename'] = [
     '#type' => 'textfield',
     '#title' => t('Source Name'),
     '#required' => TRUE,
     '#default_value' => $sourcename,
     '#description' => t('The name of the source data.  This could be a file name, data set name or a
          small description for how the data was collected.  For long descriptions use the description field below'),
-  );
-  $form['sourceversion']= array(
+  ];
+  $form['sourceversion'] = [
     '#type' => 'textfield',
     '#title' => t('Source Version'),
     '#required' => FALSE,
     '#default_value' => $sourceversion,
     '#description' => t('If the source dataset has a version, include it here'),
-  );
-  $form['sourceuri']= array(
+  ];
+  $form['sourceuri'] = [
     '#type' => 'textfield',
     '#title' => t('Source URI'),
     '#required' => FALSE,
@@ -206,7 +207,7 @@ function chado_analysis_form($node, &$form_state) {
     '#description' => t("This is a permanent URL or URI for the source of the analysis.
        Someone could recreate the analysis directly by going to this URI and
        fetching the source data (e.g. the blast database, or the training model)."),
-  );
+  ];
 
   // Get time saved in chado
   $default_time = $timeexecuted;
@@ -216,21 +217,21 @@ function chado_analysis_form($node, &$form_state) {
   // If the time is not set, use current time
   if (!$default_time) {
     $default_time = REQUEST_TIME;
-    $year  = format_date($default_time, 'custom', 'Y');
+    $year = format_date($default_time, 'custom', 'Y');
     $month = format_date($default_time, 'custom', 'n');
-    $day   = format_date($default_time, 'custom', 'j');
+    $day = format_date($default_time, 'custom', 'j');
   }
-  $form['timeexecuted']= array(
+  $form['timeexecuted'] = [
     '#type' => 'date',
     '#title' => t('Time Executed'),
     '#required' => TRUE,
-    '#default_value' => array(
-       'year' => $year,
-       'month' => $month,
-       'day' => $day,
-    ),
-  );
-  $form['description']= array(
+    '#default_value' => [
+      'year' => $year,
+      'month' => $month,
+      'day' => $day,
+    ],
+  ];
+  $form['description'] = [
     '#type' => 'text_format',
     '#rows' => 15,
     '#title' => t('Materials & Methods (Description and/or Program Settings)'),
@@ -239,7 +240,7 @@ function chado_analysis_form($node, &$form_state) {
     '#description' => t('Please provide all necessary information to allow
        someone to recreate the analysis, including materials and methods
        for collection of the source data and performing the analysis'),
-  );
+  ];
 
   /*
   // get node types from analysis extension modules
@@ -270,13 +271,16 @@ function chado_analysis_form($node, &$form_state) {
   $instructions = t('To add additional properties to the drop down. ' . l("Add terms to the analysis_property vocabulary", "admin/tripal/loaders/chado_cv/cvterm/add") . ".");
   $prop_cv = tripal_get_default_cv('analysisprop', 'type_id');
   $cv_id = $prop_cv ? $prop_cv->cv_id : NULL;
-  $details = array(
-    'property_table' => 'analysisprop',       // the name of the prop table
-    'chado_id' => $analysis_id,               // the value of analysis_id for this record
-    'cv_id' => $cv_id,                        // the cv.cv_id of the cv governing analysisprop.type_id
+  $details = [
+    'property_table' => 'analysisprop',
+    // the name of the prop table
+    'chado_id' => $analysis_id,
+    // the value of analysis_id for this record
+    'cv_id' => $cv_id,
+    // the cv.cv_id of the cv governing analysisprop.type_id
     'fieldset_title' => 'Properties',
-    'additional_instructions' => $instructions
-  );
+    'additional_instructions' => $instructions,
+  ];
   chado_add_node_form_properties($form, $form_state, $details);
 
   return $form;
@@ -307,7 +311,7 @@ function tripal_analysis_validate($node, $form, &$form_state) {
   // Since this validate can be called on AJAX and Deletion of the node
   // we need to make this check to ensure queries are not executed
   // without the proper values.
-  if($node->op != 'Save') {
+  if ($node->op != 'Save') {
     return;
   }
 
@@ -330,14 +334,14 @@ function tripal_analysis_validate($node, $form, &$form_state) {
   if (!is_null($node->nid)) {
 
     // get the existing node
-    $values = array('analysis_id' => $node->analysis_id);
-    $result = chado_select_record('analysis', array('*'), $values);
+    $values = ['analysis_id' => $node->analysis_id];
+    $result = chado_select_record('analysis', ['*'], $values);
     $analysis = $result[0];
 
     // if the name has changed make sure it doesn't conflict with an existing name
     if ($analysis->name != $node->analysisname) {
-      $values = array('name' => $node->analysisname);
-      $result = chado_select_record('analysis', array('analysis_id'), $values);
+      $values = ['name' => $node->analysisname];
+      $result = chado_select_record('analysis', ['analysis_id'], $values);
       if ($result and count($result) > 0) {
         form_set_error('analysisname', 'Cannot update the analysis with this analysis name. An analysis with this name already exists.');
         return;
@@ -347,13 +351,13 @@ function tripal_analysis_validate($node, $form, &$form_state) {
     // if the unique constraint has changed check to make sure it doesn't conflict with an
     // existing record
     if ($analysis->program != $node->program or $analysis->programversion != $node->programversion or
-       $analysis->sourcename != $node->sourcename) {
-      $values = array(
+      $analysis->sourcename != $node->sourcename) {
+      $values = [
         'program' => $node->program,
         'programversion' => $node->programversion,
         'sourcename' => $node->sourcename,
-      );
-      $result = chado_select_record('analysis', array('analysis_id'), $values);
+      ];
+      $result = chado_select_record('analysis', ['analysis_id'], $values);
       if ($result and count($result) > 0) {
         if ($analysis->program != $node->program) {
           $field = 'program';
@@ -372,12 +376,12 @@ function tripal_analysis_validate($node, $form, &$form_state) {
   }
   // Validating for an insert
   else {
-    $values = array(
+    $values = [
       'program' => $node->program,
       'programversion' => $node->programversion,
       'sourcename' => $node->sourcename,
-    );
-    $analysis = chado_select_record('analysis', array('analysis_id'), $values);
+    ];
+    $analysis = chado_select_record('analysis', ['analysis_id'], $values);
     if ($analysis and count($analysis) > 0) {
       form_set_error('program', 'Cannot add the analysis with this program,
         program version and source name. An analysis with these values already exists.');
@@ -387,8 +391,8 @@ function tripal_analysis_validate($node, $form, &$form_state) {
     // make sure we have a unique analysis name. This is not a requirement
     // for the analysis table but we use the analysis name for the Drupal node
     // title, so it should be unique
-    $values = array('name' => $node->analysisname);
-    $result = chado_select_record('analysis', array('analysis_id'), $values);
+    $values = ['name' => $node->analysisname];
+    $result = chado_select_record('analysis', ['analysis_id'], $values);
     if ($result and count($result) > 0) {
       form_set_error('analysisname', 'Cannot add the analysis with this analysis name. An analysis with this name already exists.');
       return;
@@ -413,7 +417,7 @@ function chado_analysis_insert($node) {
   $node->sourcename = trim($node->sourcename);
   $node->sourceversion = trim($node->sourceversion);
   $node->sourceuri = trim($node->sourceuri);
-  $node->description  = trim($node->description['value']);
+  $node->description = trim($node->description['value']);
 
   // if there is an analysis_id in the $node object then this must be a sync so
   // we can skip adding the analysis as it is already there, although
@@ -421,40 +425,40 @@ function chado_analysis_insert($node) {
   if (!property_exists($node, 'analysis_id')) {
 
     // Create a timestamp so we can insert it into the chado database
-    $time  = $node->timeexecuted;
+    $time = $node->timeexecuted;
     $month = $time['month'];
-    $day   = $time['day'];
-    $year  = $time['year'];
+    $day = $time['day'];
+    $year = $time['year'];
     $timestamp = $month . '/' . $day . '/' . $year;
 
     // Insert and then get the newly inserted analysis record
-    $values = array(
-      'name'           => $node->analysisname,
-      'description'    => $node->description,
-      'program'        => $node->program,
+    $values = [
+      'name' => $node->analysisname,
+      'description' => $node->description,
+      'program' => $node->program,
       'programversion' => $node->programversion,
-      'algorithm'      => $node->algorithm,
-      'sourcename'     => $node->sourcename,
-      'sourceversion'  => $node->sourceversion,
-      'sourceuri'      => $node->sourceuri,
-      'timeexecuted'   => $timestamp
-    );
+      'algorithm' => $node->algorithm,
+      'sourcename' => $node->sourcename,
+      'sourceversion' => $node->sourceversion,
+      'sourceuri' => $node->sourceuri,
+      'timeexecuted' => $timestamp,
+    ];
     $analysis = chado_insert_record('analysis', $values);
     if (!$analysis) {
       drupal_set_message(t('Unable to add analysis.'), 'warning');
       tripal_report_error('tripal_analysis', TRIPAL_ERROR, 'Insert analysis: Unable to create analysis where values:%values',
-        array('%values' => print_r($values, TRUE)));
+        ['%values' => print_r($values, TRUE)]);
       return;
     }
     $analysis_id = $analysis['analysis_id'];
 
     // now add in the properties
-    $details = array(
+    $details = [
       'property_table' => 'analysisprop',
       'base_table' => 'analysis',
       'foreignkey_name' => 'analysis_id',
-      'foreignkey_value' => $analysis_id
-    );
+      'foreignkey_value' => $analysis_id,
+    ];
     chado_update_node_form_properties($node, $details);
   }
   else {
@@ -495,14 +499,14 @@ function chado_analysis_delete($node) {
 
   // Remove data from the {chado_analysis}, {node}, and {node_revisions} tables
   $sql_del = "DELETE FROM {chado_analysis} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
   $sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
   $sql_del = "DELETE FROM {node_revision} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
 
   //Remove from analysis and analysisprop tables of chado database as well
-  chado_query("DELETE FROM {analysis} WHERE analysis_id = :analysis_id", array(':analysis_id' => $analysis_id));
+  chado_query("DELETE FROM {analysis} WHERE analysis_id = :analysis_id", [':analysis_id' => $analysis_id]);
 }
 
 /**
@@ -519,7 +523,7 @@ function chado_analysis_update($node) {
   $node->sourcename = trim($node->sourcename);
   $node->sourceversion = trim($node->sourceversion);
   $node->sourceuri = trim($node->sourceuri);
-  $node->description  = trim($node->description['value']);
+  $node->description = trim($node->description['value']);
 
   // Create a timestamp so we can insert it into the chado database
   $time = $node->timeexecuted;
@@ -530,36 +534,36 @@ function chado_analysis_update($node) {
 
   // update the record in Chado
   $analysis_id = chado_get_id_from_nid('analysis', $node->nid);
-  $match = array(
+  $match = [
     'analysis_id' => $node->analysis_id,
-  );
-  $values = array(
-    'name'           => $node->analysisname,
-    'description'    => $node->description,
-    'program'        => $node->program,
+  ];
+  $values = [
+    'name' => $node->analysisname,
+    'description' => $node->description,
+    'program' => $node->program,
     'programversion' => $node->programversion,
-    'algorithm'      => $node->algorithm,
-    'sourcename'     => $node->sourcename,
-    'sourceversion'  => $node->sourceversion,
-    'sourceuri'      => $node->sourceuri,
-    'timeexecuted'   => $timestamp,
-    'analysis_id'    => $analysis_id
-  );
+    'algorithm' => $node->algorithm,
+    'sourcename' => $node->sourcename,
+    'sourceversion' => $node->sourceversion,
+    'sourceuri' => $node->sourceuri,
+    'timeexecuted' => $timestamp,
+    'analysis_id' => $analysis_id,
+  ];
   $status = chado_update_record('analysis', $match, $values);
   if (!$status) {
     drupal_set_message(t('Unable to update analysis.', 'warning'));
     tripal_report_error('tripal_analysis', TRIPAL_ERROR, 'Update analysis: Unable to update analysis where values: %values',
-    array('%values' => print_r($values, TRUE)));
+      ['%values' => print_r($values, TRUE)]);
   }
 
   // now add in the properties by first removing any the analysis
   // already has and adding the ones we have
-  $details = array(
+  $details = [
     'property_table' => 'analysisprop',
     'base_table' => 'analysis',
     'foreignkey_name' => 'analysis_id',
-    'foreignkey_value' => $analysis_id
-  );
+    'foreignkey_value' => $analysis_id,
+  ];
   chado_update_node_form_properties($node, $details);
 }
 
@@ -583,7 +587,7 @@ function chado_analysis_load($nodes) {
     }
 
     // build the analysis variable
-    $values = array('analysis_id' => $analysis_id);
+    $values = ['analysis_id' => $analysis_id];
     $analysis = chado_generate_var('analysis', $values);
 
     // add in the description field
@@ -600,21 +604,22 @@ function chado_analysis_load($nodes) {
  *
  * This hook allows node modules to limit access to the node types they define.
  *
- *  @param $node
- *  The node on which the operation is to be performed, or, if it does not yet exist, the
- *  type of node to be created
+ * @param $node
+ *  The node on which the operation is to be performed, or, if it does not yet
+ *   exist, the type of node to be created
  *
- *  @param $op
+ * @param $op
  *  The operation to be performed
  *
- *  @param $account
- *  A user object representing the user for whom the operation is to be performed
+ * @param $account
+ *  A user object representing the user for whom the operation is to be
+ *   performed
  *
- *  @return
- *  If the permission for the specified operation is not set then return FALSE. If the
- *  permission is set then return NULL as this allows other modules to disable
- *  access.  The only exception is when the $op == 'create'.  We will always
- *  return TRUE if the permission is set.
+ * @return
+ *  If the permission for the specified operation is not set then return FALSE.
+ *   If the permission is set then return NULL as this allows other modules to
+ *   disable access.  The only exception is when the $op == 'create'.  We will
+ *   always return TRUE if the permission is set.
  *
  * @ingroup tripal_legacy_analysis
  */
@@ -625,7 +630,7 @@ function tripal_analysis_node_access($node, $op, $account) {
     $node_type = $node->type;
   }
 
-  if($node_type == 'chado_analysis') {
+  if ($node_type == 'chado_analysis') {
     if ($op == 'create') {
       if (!user_access('create chado_analysis content', $account)) {
         return NODE_ACCESS_DENY;
@@ -662,25 +667,25 @@ function tripal_analysis_node_view($node, $view_mode, $langcode) {
     case 'chado_analysis':
       // Show feature browser and counts
       if ($view_mode == 'full') {
-        $node->content['tripal_analysis_base'] = array(
+        $node->content['tripal_analysis_base'] = [
           '#theme' => 'tripal_analysis_base',
           '#node' => $node,
-          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_id' => 'base',
           '#tripal_toc_title' => 'Overview',
           '#weight' => -100,
-        );
-        $node->content['tripal_analysis_properties'] = array(
+        ];
+        $node->content['tripal_analysis_properties'] = [
           '#theme' => 'tripal_analysis_properties',
           '#node' => $node,
-          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_id' => 'properties',
           '#tripal_toc_title' => 'Properties',
-        );
+        ];
       }
       if ($view_mode == 'teaser') {
-        $node->content['tripal_analysis_teaser'] = array(
+        $node->content['tripal_analysis_teaser'] = [
           '#theme' => 'tripal_analysis_teaser',
           '#node' => $node,
-        );
+        ];
       }
       break;
   }
@@ -711,12 +716,12 @@ function tripal_analysis_node_presave($node) {
   // modules will use this module as a type of "inherited" class, so we don't know
   // for sure when type of analysis we have.  If this is a sync then
   if (property_exists($node, 'program') and
-      property_exists($node, 'programversion') and
-      property_exists($node, 'sourcename')) {
-    $name           = $node->analysisname;
-    $program        = $node->program;
+    property_exists($node, 'programversion') and
+    property_exists($node, 'sourcename')) {
+    $name = $node->analysisname;
+    $program = $node->program;
     $programversion = $node->programversion;
-    $sourcename     = $node->sourcename;
+    $sourcename = $node->sourcename;
     // now construct the title
     $node->title = "$program ($programversion) $sourcename";
     if ($name) {
@@ -725,17 +730,19 @@ function tripal_analysis_node_presave($node) {
     // reset the type
     //$node->type = $node->analysis_type;
   }
-  else if (property_exists($node, 'analysis')) {
-    $name           = $node->analysis->name;
-    $program        = $node->analysis->program;
-    $programversion = $node->analysis->programversion;
-    $sourcename     = $node->analysis->sourcename;
-    // now construct the title
-    $node->title = "$program ($programversion) $sourcename";
-    if ($name) {
-      $node->title = $name;
+  else {
+    if (property_exists($node, 'analysis')) {
+      $name = $node->analysis->name;
+      $program = $node->analysis->program;
+      $programversion = $node->analysis->programversion;
+      $sourcename = $node->analysis->sourcename;
+      // now construct the title
+      $node->title = "$program ($programversion) $sourcename";
+      if ($name) {
+        $node->title = $name;
+      }
+      //$node->type = $node->analysis_type;
     }
-    //$node->type = $node->analysis_type;
   }
 }
 
@@ -754,7 +761,7 @@ function tripal_analysis_node_insert($node) {
       // we need to simulate one so that the right values are available for
       // the URL to be determined.
       $analysis_id = chado_get_id_from_nid('analysis', $node->nid);
-      $values = array('analysis_id' => $analysis_id);
+      $values = ['analysis_id' => $analysis_id];
       $analysis = chado_generate_var('analysis', $values);
       $node->analysis = $analysis;
 

+ 33 - 34
legacy/tripal_analysis/includes/tripal_analysis.delete.inc

@@ -2,41 +2,41 @@
 
 /**
  * @file
-* Administration Interface for deleting multiple analyses
-*/
+ * Administration Interface for deleting multiple analyses
+ */
 
 /**
  * A form for indicating the analyses to delete
-*
-* @ingroup tripal_legacy_analysis
-*/
+ *
+ * @ingroup tripal_legacy_analysis
+ */
 function tripal_analysis_delete_form() {
   // get the list of analyses
   $sql = "SELECT * FROM {analysis} ORDER BY name";
   $org_rset = chado_query($sql);
-  $analyses = array();
+  $analyses = [];
   while ($analysis = $org_rset->fetchObject()) {
     $analyses[$analysis->analysis_id] = "$analysis->name";
   }
 
-  $form['desc'] = array(
-      '#markup' => t("Use the following form to delete analyses which may or may
+  $form['desc'] = [
+    '#markup' => t("Use the following form to delete analyses which may or may
         not be synced. Please be cautious. Deleting an analysis will cause all
         data associated with the analysis to also be deleted."),
-  );
-
-  $form['analyses'] = array(
-      '#title'       => t('analysis'),
-      '#type'        => 'checkboxes',
-      '#options'     => $analyses,
-      '#prefix'      => '<div style="height: 400px; overflow: scroll">',
-      '#suffix'      => '</div><br>',
-  );
-
-  $form['button'] = array(
-      '#type' => 'submit',
-      '#value' => t('Delete analyses'),
-  );
+  ];
+
+  $form['analyses'] = [
+    '#title' => t('analysis'),
+    '#type' => 'checkboxes',
+    '#options' => $analyses,
+    '#prefix' => '<div style="height: 400px; overflow: scroll">',
+    '#suffix' => '</div><br>',
+  ];
+
+  $form['button'] = [
+    '#type' => 'submit',
+    '#value' => t('Delete analyses'),
+  ];
   return $form;
 }
 
@@ -49,8 +49,8 @@ function tripal_analysis_delete_form_submit($form, &$form_state) {
   global $user;
 
   // Convert the analyses input into an array of just ids.
-  $analyses   = $form_state['values']['analyses'];
-  $org_ids = array();
+  $analyses = $form_state['values']['analyses'];
+  $org_ids = [];
   foreach ($analyses as $id => $val) {
     if ($val != 0) {
       $org_ids[] = $id;
@@ -58,10 +58,10 @@ function tripal_analysis_delete_form_submit($form, &$form_state) {
   }
 
   if (count($org_ids) > 0) {
-    $args = array($org_ids);
+    $args = [$org_ids];
 
     tripal_add_job("Delete analysis", 'tripal_analysis',
-    'tripal_analysis_delete_analyses', $args, $user->uid);
+      'tripal_analysis_delete_analyses', $args, $user->uid);
     drupal_set_message(t("analyses will disappear from the list below once the job completes."));
   }
   else {
@@ -92,21 +92,20 @@ function tripal_analysis_delete_analyses($analyses, $job = NULL) {
   // begin the transaction
   $transaction = db_transaction();
   print "\nNOTE: Deleting analyses is performed using a database transaction. \n" .
-      "If the load fails or is terminated prematurely then the entire set of \n" .
-      "deletions is rolled back and will not be found in the database\n\n";
+    "If the load fails or is terminated prematurely then the entire set of \n" .
+    "deletions is rolled back and will not be found in the database\n\n";
 
   try {
-    $values = array(
-        'analysis_id' => $analyses
-    );
-    $num_deletes = chado_select_record('analysis', array('count(*) as cnt'), $values);
+    $values = [
+      'analysis_id' => $analyses,
+    ];
+    $num_deletes = chado_select_record('analysis', ['count(*) as cnt'], $values);
     print "Deleting " . $num_deletes[0]->cnt . " analyses\n";
     chado_delete_record('analysis', $values);
 
     print "Removing orphaned analysis pages\n";
     chado_cleanup_orphaned_nodes('analysis');
-  }
-  catch (Exception $e) {
+  } catch (Exception $e) {
     print "\n"; // make sure we start errors on new line
     $transaction->rollback();
     print "FAILED: Rolling back database changes...\n";

+ 27 - 15
legacy/tripal_analysis/includes/tripal_analysis_privacy.inc

@@ -7,7 +7,8 @@
  */
 
 /**
- * Perform permission check by analysis_id only if 'node_privacy_byrole' module is enabled
+ * Perform permission check by analysis_id only if 'node_privacy_byrole' module
+ * is enabled
  *
  * @param $analysis_id
  *   Which analysis to check if the user has permission to view
@@ -25,7 +26,10 @@ function tripal_analysis_check_permission($analysis_id) {
         FROM {node_access} NA
           INNER JOIN {chado_analysis} CA ON NA.nid = CA.nid
         WHERE analysis_id = :analysis_id AND gid = :gid";
-      $access = db_query($p_sql, array(':analysis_id' => $analysis_id, ':gid' => $rid))->fetchField();
+      $access = db_query($p_sql, [
+        ':analysis_id' => $analysis_id,
+        ':gid' => $rid,
+      ])->fetchField();
       if ($access == 1) {
         $node_access = 1;
         break;
@@ -38,7 +42,7 @@ function tripal_analysis_check_permission($analysis_id) {
       return FALSE;
     }
 
-  // If 'node_privacy_byrole' module is not enabled, return TRUE;
+    // If 'node_privacy_byrole' module is not enabled, return TRUE;
   }
   else {
     return TRUE;
@@ -47,6 +51,7 @@ function tripal_analysis_check_permission($analysis_id) {
 
 /**
  * Set permissions for features associated with an analysis
+ *
  * @todo Stephen: ensure the $nid param is defined correctly
  *
  * @param $analysis_id
@@ -62,19 +67,19 @@ function tripal_analysis_set_feature_permission($analysis_id, $nid) {
 
   // Get features associated with the analysis
   $sql = "SELECT feature_id FROM {analysisfeature} WHERE analysis_id = :analysis_id";
-  $features = chado_query($sql, array(':analysis_id' => $analysis_id));
+  $features = chado_query($sql, [':analysis_id' => $analysis_id]);
 
   // Convert feature_id into node_id
-  $feature_nids = array();
+  $feature_nids = [];
   $counter = 0;
   $sql = "SELECT nid FROM {chado_feature} WHERE feature_id = :feature_id";
   while ($feature = $features->fetchObject()) {
-    $feature_nids[$counter] = db_query($sql, array(':feature_id' => $feature->feature_id))->fetchField();
-    $counter ++;
+    $feature_nids[$counter] = db_query($sql, [':feature_id' => $feature->feature_id])->fetchField();
+    $counter++;
   }
 
   //Convert analysis_id into node_id
-  $ana_nid = db_result(db_query("SELECT nid FROM {chado_analysis} WHERE analysis_id = :analysis_id", array(':analysis_id' => $analysis_id)));
+  $ana_nid = db_result(db_query("SELECT nid FROM {chado_analysis} WHERE analysis_id = :analysis_id", [':analysis_id' => $analysis_id]));
   // Get available roles
   $roles = array_keys(user_roles());
 
@@ -89,20 +94,27 @@ function tripal_analysis_set_feature_permission($analysis_id, $nid) {
       print $percentage . "% ";
     }
 
-    db_query("DELETE FROM {node_privacy_byrole} WHERE nid = :nid AND realm = 'node_privacy_byrole_role'", array(':nid' => $fnid));
+    db_query("DELETE FROM {node_privacy_byrole} WHERE nid = :nid AND realm = 'node_privacy_byrole_role'", [':nid' => $fnid]);
     foreach ($roles AS $rid) {
       // Get permissions of this analysis for this role
       $rsql = "SELECT * FROM {node_privacy_byrole} WHERE gid = :gid AND nid = :nid AND realm = 'node_privacy_byrole_role'";
-      $ana_perm = db_query($rsql, array(':gid' => $rid, ':nid' => $ana_nid))->fetchObject();
+      $ana_perm = db_query($rsql, [
+        ':gid' => $rid,
+        ':nid' => $ana_nid,
+      ])->fetchObject();
       db_query("INSERT INTO {node_privacy_byrole} (nid, gid, realm, grant_view, grant_update, grant_delete)
                 VALUES (:nid, :gid, :realm, :grant_view, :grant_update, :grant_delete)",
-                array(':nid' => $fnid, ':gid' => $rid, ':realm' => 'node_privacy_byrole_role',
-                      ':grant_view' => $ana_perm->grant_view,
-                      ':grant_update' => $ana_perm->grant_update,
-                      ':grant_delete' => $ana_perm->grant_delete));
+        [
+          ':nid' => $fnid,
+          ':gid' => $rid,
+          ':realm' => 'node_privacy_byrole_role',
+          ':grant_view' => $ana_perm->grant_view,
+          ':grant_update' => $ana_perm->grant_update,
+          ':grant_delete' => $ana_perm->grant_delete,
+        ]);
     }
     $node = node_load($fnid);
     node_save($node);
-    $idx_iterations ++;
+    $idx_iterations++;
   }
 }

+ 48 - 48
legacy/tripal_analysis/theme/templates/tripal_analysis_base.tpl.php

@@ -1,112 +1,112 @@
 <?php
 $analysis = $variables['node']->analysis;
-$analysis = chado_expand_var($analysis,'field','analysis.description'); ?>
+$analysis = chado_expand_var($analysis, 'field', 'analysis.description'); ?>
+
+<div class="tripal__analysis-data-block-desc tripal-data-block-desc"></div><?php
 
-<div class="tripal__analysis-data-block-desc tripal-data-block-desc"></div><?php 
-  
 // the $headers array is an array of fields to use as the colum headers. 
 // additional documentation can be found here 
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
 // This table for the analysis has a vertical header (down the first column)
 // so we do not provide headers here, but specify them in the $rows array below.
-$headers = array();
+$headers = [];
 
 // the $rows array contains an array of rows where each row is an array
 // of values for each column of the table in that row.  Additional documentation
 // can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-$rows = array();
+$rows = [];
 
 // Analysis Name row
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Analysis Name',
     'header' => TRUE,
     'width' => '20%',
-  ),
-  $analysis->name
-);
+  ],
+  $analysis->name,
+];
 
 // Implementation row
 $software = $analysis->program;
-if($analysis->programversion != 'n/a'){
-  $software .=  " (" . $analysis->programversion . ")";
+if ($analysis->programversion != 'n/a') {
+  $software .= " (" . $analysis->programversion . ")";
 }
-if($analysis->algorithm){
+if ($analysis->algorithm) {
   $software .= ". " . $analysis->algorithm;
 }
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Method',
-    'header' => TRUE
-  ),
-  $software
-);
+    'header' => TRUE,
+  ],
+  $software,
+];
 
 // Source row
 $source = '';
-if($analysis->sourceuri){
+if ($analysis->sourceuri) {
   $source = "<a href=\"$analysis->sourceuri\">$analysis->sourcename</a>";
-} 
+}
 else {
   $source = $analysis->sourcename;
 }
-if($analysis->sourceversion){
+if ($analysis->sourceversion) {
   $source = " (" . $analysis->sourceversion . ")";
 }
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Source',
-    'header' => TRUE
-  ),
-  $source
-);
+    'header' => TRUE,
+  ],
+  $source,
+];
 
 // Date performed row
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Date performed',
-    'header' => TRUE
-  ),
-  preg_replace("/^(\d+-\d+-\d+) .*/","$1", $analysis->timeexecuted),
-); 
+    'header' => TRUE,
+  ],
+  preg_replace("/^(\d+-\d+-\d+) .*/", "$1", $analysis->timeexecuted),
+];
 
 // allow site admins to see the analysis ID
 if (user_access('view ids')) {
   // Analysis ID
-  $rows[] = array(
-    array(
+  $rows[] = [
+    [
       'data' => 'Analysis ID',
       'header' => TRUE,
       'class' => 'tripal-site-admin-only-table-row',
-    ),
-    array(
+    ],
+    [
       'data' => $analysis->analysis_id,
       'class' => 'tripal-site-admin-only-table-row',
-    ),
-  );
+    ],
+  ];
 }
 // the $table array contains the headers and rows array as well as other
 // options for controlling the display of the table.  Additional
 // documentation can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-$table = array(
+$table = [
   'header' => $headers,
   'rows' => $rows,
-  'attributes' => array(
+  'attributes' => [
     'id' => 'tripal_analysis-table-base',
-    'class' => 'tripal-data-table'
-  ),
+    'class' => 'tripal-data-table',
+  ],
   'sticky' => FALSE,
   'caption' => '',
-  'colgroups' => array(),
+  'colgroups' => [],
   'empty' => '',
-);
+];
 
 // once we have our table array structure defined, we call Drupal's theme_table()
 // function to generate the table.
-print theme_table($table); 
+print theme_table($table);
 if (property_exists($analysis, 'description')) { ?>
-  <div style="text-align: justify"><?php print $analysis->description; ?></div> <?php  
+    <div style="text-align: justify"><?php print $analysis->description; ?></div> <?php
 } ?>
 

+ 45 - 24
legacy/tripal_analysis/theme/templates/tripal_analysis_help.tpl.php

@@ -1,38 +1,59 @@
 <h3>Module Description:</h3>
-<p>The Tripal Analysis module provides a new analysis content type that is intended to be
-  used when a more specialized analysis module does not exist.  Because it is generic, it does not
-  provide any visualization or data loading tools for analysis data.  Specialized analysis modules,
-  such as the Tripal Analysis Blast or Tripal Analysis KEGG modules provide loading and custom
-  visualizations for the analysis results.  These modules must be installed separately.
+<p>The Tripal Analysis module provides a new analysis content type that is
+    intended to be
+    used when a more specialized analysis module does not exist. Because it is
+    generic, it does not
+    provide any visualization or data loading tools for analysis data.
+    Specialized analysis modules,
+    such as the Tripal Analysis Blast or Tripal Analysis KEGG modules provide
+    loading and custom
+    visualizations for the analysis results. These modules must be installed
+    separately.
 </p>
 
 <h3>Setup Instructions:</h3>
-<p>After installation of the analysis module or any specialized analysis module.  The following tasks should be performed</p>
+<p>After installation of the analysis module or any specialized analysis module.
+    The following tasks should be performed</p>
 <ol>
-  <li><p><b>Set Permissions</b>: By default only the site administrator account has access to create, edit, delete
-   or administer analyses. Navigate to the <?php print l('permissions page', 'admin/user/permissions')?> and set the
-   permissions under the 'tripal_analysis' section as appropriate for your site. For a simple setup, allow anonymous
-   users access to view content and create a special role for creating, editing and other administrative tasks.</p></li>
+    <li><p><b>Set Permissions</b>: By default only the site administrator
+            account has access to create, edit, delete
+            or administer analyses. Navigate to
+            the <?php print l('permissions page', 'admin/user/permissions') ?>
+            and set the
+            permissions under the 'tripal_analysis' section as appropriate for
+            your site. For a simple setup, allow anonymous
+            users access to view content and create a special role for creating,
+            editing and other administrative tasks.</p></li>
 
 
-  <li><p><b>Create an Analysis</b>:  An analysis should be <?php print l('created', 'node/add/chado-analysis')?> before
-  data is imported into chado.  The generic analysis type should only be used when a more specialized analysis module
-  (e.g. Tripal Analysis Blast module) does not already exists.  All data imported into Chado should be associated with
-  an analysis to help keep track of the source for data.</p></li>
+    <li><p><b>Create an Analysis</b>: An analysis should
+            be <?php print l('created', 'node/add/chado-analysis') ?> before
+            data is imported into chado. The generic analysis type should only
+            be used when a more specialized analysis module
+            (e.g. Tripal Analysis Blast module) does not already exists. All
+            data imported into Chado should be associated with
+            an analysis to help keep track of the source for data.</p></li>
 
-  <li><p><b>Sync Analyses</b>:  If you have analyses already stored in Chado and would like to create pages for them, then
-  analyses can be synced using the
-   <?php print l('analysis configuration page', 'admin/tripal/tripal_analysis/configuration') ?>. The process of 'syncing'
-   automatically creates the pages as if you had created them using the step above.
-  </p></li>
+    <li><p><b>Sync Analyses</b>: If you have analyses already stored in Chado
+            and would like to create pages for them, then
+            analyses can be synced using the
+        <?php print l('analysis configuration page', 'admin/tripal/tripal_analysis/configuration') ?>
+            . The process of 'syncing'
+            automatically creates the pages as if you had created them using the
+            step above.
+        </p></li>
 </ol>
 
 
 <h3>Additional Features of this Module:</h3>
-  <ul>
-    <li><p><b>Simple Search Tool</b>: A <?php print l('simple search tool','chado/analyses') ?> is provided for
-    finding analyses. This tool relies on Drupal Views.  <a href="http://drupal.org/project/views">Drupal Views</a>
-    which must be installed to see the search tool.  Look for it in the navigation menu under the item
-    "Search Data". </p></li>
+<ul>
+    <li><p><b>Simple Search Tool</b>:
+            A <?php print l('simple search tool', 'chado/analyses') ?> is
+            provided for
+            finding analyses. This tool relies on Drupal Views. <a
+                    href="http://drupal.org/project/views">Drupal Views</a>
+            which must be installed to see the search tool. Look for it in the
+            navigation menu under the item
+            "Search Data". </p></li>
 </ul>
 

+ 19 - 17
legacy/tripal_analysis/theme/templates/tripal_analysis_properties.tpl.php

@@ -2,45 +2,47 @@
 
 // get the analysis object and expand it to include the records from the analysisprop table
 $analysis = $variables['node']->analysis;
-$analysis = chado_expand_var($analysis,'table', 'analysisprop', array('return_array' => 1));
+$analysis = chado_expand_var($analysis, 'table', 'analysisprop', ['return_array' => 1]);
 $properties = $analysis->analysisprop;
 
 if (count($properties) > 0) { ?>
-  <div class="tripal_analysis-data-block-desc tripal-data-block-desc">Additional information about this analysis:</div><?php
-  
+    <div class="tripal_analysis-data-block-desc tripal-data-block-desc">
+        Additional information about this analysis:
+    </div><?php
+
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Property Name', 'Value');
-  
+  $headers = ['Property Name', 'Value'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();      
+  $rows = [];
   foreach ($properties as $property) {
-    $rows[] = array(
+    $rows[] = [
       ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-      $property->value
-    );
-  } 
+      $property->value,
+    ];
+  }
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_analysis-table-properties',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
   print theme_table($table);

+ 11 - 11
legacy/tripal_analysis/theme/templates/tripal_analysis_teaser.tpl.php

@@ -1,16 +1,16 @@
 <?php
 $node = $variables['node'];
 $analysis = $variables['node']->analysis;
-$analysis = chado_expand_var($analysis,'field','analysis.description'); ?>
+$analysis = chado_expand_var($analysis, 'field', 'analysis.description'); ?>
 
-<div class="tripal_analysis_blast-teaser tripal-teaser"> 
-  <div class="tripal-analysis-blast-teaser-title tripal-teaser-title"><?php 
-    print l($node->title, "node/$node->nid", array('html' => TRUE));?>
-  </div>
-  <div class="tripal-analysis-blast-teaser-text tripal-teaser-text"><?php 
-    print substr($analysis->description, 0, 650);
-    if (strlen($analysis->description) > 650) {
-      print "... " . l("[more]", "node/$node->nid");
-    } ?>
-  </div>
+<div class="tripal_analysis_blast-teaser tripal-teaser">
+    <div class="tripal-analysis-blast-teaser-title tripal-teaser-title"><?php
+      print l($node->title, "node/$node->nid", ['html' => TRUE]); ?>
+    </div>
+    <div class="tripal-analysis-blast-teaser-text tripal-teaser-text"><?php
+      print substr($analysis->description, 0, 650);
+      if (strlen($analysis->description) > 650) {
+        print "... " . l("[more]", "node/$node->nid");
+      } ?>
+    </div>
 </div>

+ 25 - 25
legacy/tripal_analysis/tripal_analysis.views_default.inc

@@ -13,7 +13,7 @@
  * @ingroup tripal_legacy_analysis
  */
 function tripal_analysis_views_default_views() {
-  $views = array();
+  $views = [];
 
   // User View ("Search Biological Content")
   // Remember, if you change the name/path of this view,
@@ -104,57 +104,57 @@ function tripal_analysis_defaultvalue_admin_analysis() {
   $handler->display->display_options['pager']['options']['quantity'] = '9';
   $handler->display->display_options['style_plugin'] = 'table';
   $handler->display->display_options['style_options']['grouping'] = '';
-  $handler->display->display_options['style_options']['columns'] = array(
+  $handler->display->display_options['style_options']['columns'] = [
     'name' => 'name',
     'program' => 'program',
     'sourcename' => 'sourcename',
     'num_features' => 'num_features',
     'timeexecuted' => 'timeexecuted',
-  );
+  ];
   $handler->display->display_options['style_options']['default'] = 'name';
-  $handler->display->display_options['style_options']['info'] = array(
-    'name' => array(
+  $handler->display->display_options['style_options']['info'] = [
+    'name' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'program' => array(
+    ],
+    'program' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'sourcename' => array(
+    ],
+    'sourcename' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'num_features' => array(
+    ],
+    'num_features' => [
       'separator' => '',
-    ),
-    'timeexecuted' => array(
+    ],
+    'timeexecuted' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-  );
+    ],
+  ];
   /* Header: Global: Action Links */
   $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
   $handler->display->display_options['header']['action_links_area']['table'] = 'views';
   $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
   $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
   $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
-  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+  $handler->display->display_options['header']['action_links_area']['link-1'] = [
     'label-1' => 'Add Analysis',
     'path-1' => 'node/add/tripal-analysis',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-2'] = [
     'label-2' => '',
     'path-2' => '',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-3'] = [
     'label-3' => '',
     'path-3' => '',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-4'] = [
     'label-4' => '',
     'path-4' => '',
-  );
+  ];
   /* No results behavior: Global: Text area */
   $handler->display->display_options['empty']['text']['id'] = 'text';
   $handler->display->display_options['empty']['text']['table'] = 'views';
@@ -244,11 +244,11 @@ function tripal_analysis_defaultvalue_admin_analysis() {
   $handler->display->display_options['filters']['program']['expose']['label'] = 'Program Name Contains';
   $handler->display->display_options['filters']['program']['expose']['operator'] = 'program_op';
   $handler->display->display_options['filters']['program']['expose']['identifier'] = 'program';
-  $handler->display->display_options['filters']['program']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['program']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
   /* Filter criterion: Chado Analysis: Sourcename */
   $handler->display->display_options['filters']['sourcename']['id'] = 'sourcename';
   $handler->display->display_options['filters']['sourcename']['table'] = 'analysis';

+ 62 - 61
legacy/tripal_contact/api/tripal_contact.DEPRECATED.inc

@@ -1,13 +1,14 @@
 <?php
 /**
  * @file
- * Wrapper functions to provide backwards compatibility for the tripal contact api
+ * Wrapper functions to provide backwards compatibility for the tripal contact
+ *   api
  */
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_get_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_get_property().
  *
  * @see chado_get_property().
  */
@@ -17,28 +18,28 @@ function tripal_contact_get_property($contact_id, $property) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_contact_get_property',
-      '%new_function' => 'chado_get_property'
-    )
+    [
+      '%old_function' => 'tripal_contact_get_property',
+      '%new_function' => 'chado_get_property',
+    ]
   );
-  
-  $record = array(
+
+  $record = [
     'table' => 'contact',
-    'id' => $contact_id
-  );
-  $property = array(
+    'id' => $contact_id,
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => 'contact_property',
-  );
+  ];
 
   return chado_get_property($record, $property);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_insert_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_insert_property().
  *
  * @see chado_insert_property().
  */
@@ -48,31 +49,31 @@ function tripal_contact_insert_property($contact_id, $property, $value, $update_
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_contact_insert_property',
-      '%new_function' => 'chado_insert_property'
-    )
+    [
+      '%old_function' => 'tripal_contact_insert_property',
+      '%new_function' => 'chado_insert_property',
+    ]
   );
 
-  $record = array(
+  $record = [
     'table' => 'contact',
-    'id' => $contact_id
-  );
-  $property = array(
+    'id' => $contact_id,
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => 'contact_property',
     'value' => $value,
-  );
-  $options = array(
-    'update_if_present' => $update_if_present
-  );
+  ];
+  $options = [
+    'update_if_present' => $update_if_present,
+  ];
   return chado_insert_property($record, $property, $options);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_update_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_update_property().
  *
  * @see chado_update_property().
  */
@@ -82,30 +83,30 @@ function tripal_contact_update_property($contact_id, $property, $value, $insert_
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_contact_update_property',
-      '%new_function' => 'chado_update_property'
-    )
+    [
+      '%old_function' => 'tripal_contact_update_property',
+      '%new_function' => 'chado_update_property',
+    ]
   );
-  $record = array(
+  $record = [
     'table' => 'contact',
-    'id' => $contact_id
-  );
-  $property = array(
+    'id' => $contact_id,
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => 'contact_property',
     'value' => $value,
-  );
-  $options = array(
-    'insert_if_missing' => $insert_if_missing
-  );
+  ];
+  $options = [
+    'insert_if_missing' => $insert_if_missing,
+  ];
   return chado_update_property($record, $property, $options);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_delete_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_delete_property().
  *
  * @see chado_delete_property().
  */
@@ -115,26 +116,26 @@ function tripal_contact_delete_property($contact_id, $property) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_contact_delete_property',
-      '%new_function' => 'chado_delete_property'
-    )
+    [
+      '%old_function' => 'tripal_contact_delete_property',
+      '%new_function' => 'chado_delete_property',
+    ]
   );
-  $record = array(
+  $record = [
     'table' => 'contact',
-    'id' => $contact_id
-  );
-  $property = array(
+    'id' => $contact_id,
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => 'contact_property',
-  );
+  ];
   return chado_delete_property($record, $property);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_insert_contact().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_insert_contact().
  *
  * @see tripal_insert_contact().
  */
@@ -144,16 +145,16 @@ function tripal_contact_add_contact($name, $description, $type, $properties) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_contact_add_contact',
-      '%new_function' => 'tripal_insert_contact'
-    )
+    [
+      '%old_function' => 'tripal_contact_add_contact',
+      '%new_function' => 'tripal_insert_contact',
+    ]
   );
 
-  return tripal_insert_contact(array(
+  return tripal_insert_contact([
     'name' => $name,
     'description' => $description,
     'type_name' => $type,
-    'properties' => $properties
-  ));
+    'properties' => $properties,
+  ]);
 }

+ 24 - 22
legacy/tripal_contact/includes/tripal_contact.admin.inc

@@ -7,8 +7,8 @@
  */
 
 /**
- * Launchpage for contact administration. Makes sure views are enabled and if not provides
- * links to enable them.
+ * Launchpage for contact administration. Makes sure views are enabled and if
+ * not provides links to enable them.
  *
  * @ingroup tripal_legacy_contact
  */
@@ -16,7 +16,7 @@ function tripal_contact_admin_contact_view() {
   $output = '';
 
   // set the breadcrumb
-  $breadcrumb = array();
+  $breadcrumb = [];
   $breadcrumb[] = l('Home', '<front>');
   $breadcrumb[] = l('Administration', 'admin');
   $breadcrumb[] = l('Tripal', 'admin/tripal');
@@ -25,7 +25,7 @@ function tripal_contact_admin_contact_view() {
   drupal_set_breadcrumb($breadcrumb);
 
   // Add the view
-  $view = views_embed_view('tripal_contact_admin_contacts','default');
+  $view = views_embed_view('tripal_contact_admin_contacts', 'default');
   if (isset($view)) {
     $output .= $view;
   }
@@ -35,7 +35,7 @@ function tripal_contact_admin_contact_view() {
       . 'administrative interface are disabled. <strong>Click each of the following links to '
       . 'enable the pertinent views</strong>:</p>';
     $output .= '<ul>';
-      $output .= '<li>'.l('Contacts View', 'admin/tripal/legacy/tripal_contact/views/contacts/enable').'</li>';
+    $output .= '<li>' . l('Contacts View', 'admin/tripal/legacy/tripal_contact/views/contacts/enable') . '</li>';
     $output .= '</ul>';
   }
 
@@ -48,36 +48,38 @@ function tripal_contact_admin_contact_view() {
  * @ingroup tripal_legacy_contact
  */
 function tripal_contact_admin() {
-  $form = array();
+  $form = [];
 
   // If your module is using the Chado Node: Title & Path API to allow custom titles
   // for your node type then you need to add the configuration form for this functionality.
-  $details = array(
-    'module' => 'tripal_contact',       // the name of the MODULE implementing the content type
-    'content_type' => 'chado_contact',   // the name of the content type
-      // An array of options to use under "Page Titles"
-      // the key should be the token and the value should be the human-readable option
-    'options' => array(
+  $details = [
+    'module' => 'tripal_contact',
+    // the name of the MODULE implementing the content type
+    'content_type' => 'chado_contact',
+    // the name of the content type
+    // An array of options to use under "Page Titles"
+    // the key should be the token and the value should be the human-readable option
+    'options' => [
       '[contact.name]' => 'Contact Name Only',
-        // there should always be one options matching the unique constraint.
-      '[contact.name]' => 'Unique Contraint: The name of the contact'
-    ),
+      // there should always be one options matching the unique constraint.
+      '[contact.name]' => 'Unique Contraint: The name of the contact',
+    ],
     // the token indicating the unique constraint in the options array
-    'unique_option' => '[contact.name]'
-  );
+    'unique_option' => '[contact.name]',
+  ];
   // This call adds the configuration form to your current form
   // This sub-form handles it's own validation & submit
   chado_add_admin_form_set_title($form, $form_state, $details);
 
   // URL ALIAS
-  $details = array(
+  $details = [
     'module' => 'tripal_contact',
     'content_type' => 'chado_contact',
-    'options' => array(
+    'options' => [
       '/contact/[contact.contact_id]' => 'Contact ID',
-      '/contact/[contact.name]' => 'Unique Contraint: The name of the contact'
-    ),
-  );
+      '/contact/[contact.name]' => 'Unique Contraint: The name of the contact',
+    ],
+  ];
 
   // This call adds the configuration form to your current form
   // This sub-form handles it's own validation & submit

+ 174 - 158
legacy/tripal_contact/includes/tripal_contact.chado_node.inc

@@ -8,52 +8,53 @@
 
 /**
  * Implementation of hook_node_info().
- * This node_info, is a simple node that describes the functionallity of the module.
+ * This node_info, is a simple node that describes the functionallity of the
+ * module.
  *
  * @ingroup tripal_legacy_contact
  */
 function tripal_contact_node_info() {
 
-  return array(
-    'chado_contact' => array(
-      'name'        => t('Contact (Tripal v2 legacy)'),
-      'base'        => 'chado_contact',
+  return [
+    'chado_contact' => [
+      'name' => t('Contact (Tripal v2 legacy)'),
+      'base' => 'chado_contact',
       'description' => t('A contact from the Chado database'),
-      'has_title'   => TRUE,
-      'locked'      => TRUE,
-      'chado_node_api' => array(
+      'has_title' => TRUE,
+      'locked' => TRUE,
+      'chado_node_api' => [
         'base_table' => 'contact',
         'hook_prefix' => 'chado_contact',
-        'record_type_title' => array(
+        'record_type_title' => [
           'singular' => t('Contact'),
-          'plural' => t('Contacts')
-        ),
-        'sync_filters' => array(
+          'plural' => t('Contacts'),
+        ],
+        'sync_filters' => [
           'type_id' => FALSE,
-          'organism_id' => FALSE
-        ),
-      )
-    ),
-  );
+          'organism_id' => FALSE,
+        ],
+      ],
+    ],
+  ];
 }
 
 /**
  * Implementation of hook_form().
  *
- *  @parm $node
+ * @parm $node
  *    The node that is created when the database is initialized
  *
- *  @parm $form_state
- *    The state of the form, that has the user entered information that is neccessary for, setting
- *    up the database tables for the contact
+ * @parm $form_state
+ *    The state of the form, that has the user entered information that is
+ *   neccessary for, setting up the database tables for the contact
  *
- *  @return $form
+ * @return $form
  *    The information that was enterd allong with
  *
  * @ingroup tripal_legacy_contact
  */
 function chado_contact_form(&$node, $form_state) {
-  $form = array();
+  $form = [];
   // Default values can come in the following ways:
   //
   // 1) as elements of the $node object.  This occurs when editing an existing contact
@@ -63,9 +64,9 @@ function chado_contact_form(&$node, $form_state) {
   //    form elements and the form is being rebuilt
   //
   // set form field defaults
-  $contact_id  = null;
-  $type_id     = 0;
-  $contactname       = '';
+  $contact_id = NULL;
+  $type_id = 0;
+  $contactname = '';
   $description = '';
 
   // if we are editing an existing node then the contact is already part of the node
@@ -74,8 +75,8 @@ function chado_contact_form(&$node, $form_state) {
     $contact_id = $contact->contact_id;
 
     // get form defaults
-    $type_id     = $contact->type_id->cvterm_id;
-    $contactname       = $contact->name;
+    $type_id = $contact->type_id->cvterm_id;
+    $contactname = $contact->name;
 
     // get the contact default values.  When this module was first created
     // the contact description was incorrectly stored in the $node->body field.
@@ -96,30 +97,30 @@ function chado_contact_form(&$node, $form_state) {
     }
     if (!$description) {
       $contactprop = chado_get_property(
-        array('table' => 'contact', 'id' => $contact->contact_id),
-        array('type_name' => 'contact_description', 'cv_name' => 'tripal_contact')
+        ['table' => 'contact', 'id' => $contact->contact_id],
+        ['type_name' => 'contact_description', 'cv_name' => 'tripal_contact']
       );
       $description = (isset($contactprop->value)) ? $contactprop->value : '';
     }
 
     // set the contact_id in the form
-    $form['contact_id'] = array(
+    $form['contact_id'] = [
       '#type' => 'value',
       '#value' => $contact->contact_id,
-    );
+    ];
   }
   // if we are re constructing the form from a failed validation or ajax callback
   // then use the $form_state['values'] values
   if (array_key_exists('values', $form_state)) {
-    $type_id     = $form_state['values']['type_id'];
-    $contactname       = $form_state['values']['contactname'];
+    $type_id = $form_state['values']['type_id'];
+    $contactname = $form_state['values']['contactname'];
     $description = $form_state['values']['description'];
   }
   // if we are re building the form from after submission (from ajax call) then
   // the values are in the $form_state['input'] array
   if (array_key_exists('input', $form_state) and !empty($form_state['input'])) {
-    $type_id     = $form_state['input']['type_id'];
-    $contactname       = $form_state['input']['contactname'];
+    $type_id = $form_state['input']['type_id'];
+    $contactname = $form_state['input']['contactname'];
     $description = $form_state['input']['description'];
   }
 
@@ -153,41 +154,41 @@ function chado_contact_form(&$node, $form_state) {
   else {
     $contact_types = tripal_get_cvterm_default_select_options('contact', 'type_id', 'contact types');
   }
-  $form['type_id'] = array(
+  $form['type_id'] = [
     '#type' => 'select',
     '#title' => t('Contact Type'),
     '#options' => $contact_types,
     '#required' => TRUE,
     '#default_value' => $type_id,
-  );
+  ];
 
-  $form['contactname']= array(
-    '#type'          => 'textfield',
-    '#title'         => t('Contact Name'),
-    '#description'   => t('Enter the name of this contact'),
-    '#required'      => TRUE,
+  $form['contactname'] = [
+    '#type' => 'textfield',
+    '#title' => t('Contact Name'),
+    '#description' => t('Enter the name of this contact'),
+    '#required' => TRUE,
     '#default_value' => $contactname,
-    '#maxlength'     => 255,
-  );
-
-  $form['description']= array(
-    '#type'          => 'text_format',
-    '#title'         => t('Contact Description'),
-    '#description'   => t('A brief description of the contact'),
-    '#required'      => TRUE,
+    '#maxlength' => 255,
+  ];
+
+  $form['description'] = [
+    '#type' => 'text_format',
+    '#title' => t('Contact Description'),
+    '#description' => t('A brief description of the contact'),
+    '#required' => TRUE,
     '#default_value' => $description,
-  );
+  ];
 
   // Properties Form
   // ----------------------------------
   $prop_cv = tripal_get_default_cv('contactprop', 'type_id');
   $cv_id = $prop_cv ? $prop_cv->cv_id : NULL;
-  $select_options = array();
+  $select_options = [];
 
   // the Tripal contact vocabulary is heirarchical so if that vocab is default we
   // want to use the subset of terms not under the type 'Contact Type' for our
   // properties list.
-  if($prop_cv->name == 'tripal_contact') {
+  if ($prop_cv->name == 'tripal_contact') {
     // Need to pass in our own select_options since we use cvtermpath to filter ours
     $select_options[] = 'Select a Property';
     $sql = "
@@ -211,27 +212,34 @@ function chado_contact_form(&$node, $form_state) {
     }
   }
 
-  $details = array(
+  $details = [
     'property_table' => 'contactprop',
     'chado_id' => $contact_id,
     'cv_id' => $cv_id,
     'select_options' => $select_options,
-  );
+  ];
   chado_add_node_form_properties($form, $form_state, $details);
 
   // RELATIONSHIPS FORM
   //---------------------------------------------
   $relationship_cv = tripal_get_default_cv('contact_relationship', 'type_id');
   $cv_id = $relationship_cv ? $relationship_cv->cv_id : NULL;
-  $details = array(
-    'relationship_table' => 'contact_relationship', // the name of the _relationship table
-    'base_table' => 'contact',                      // the name of your chado base table
-    'base_foreign_key' => 'contact_id',             // the name of the key in your base chado table
-    'base_key_value' => $contact_id,                // the value of example_id for this record
-    'nodetype' => 'contact',                        // the human-readable name of your node type
-    'cv_id' => $cv_id,                              // the cv.cv_id of the cv governing contact_relationship.type_id
-    'base_name_field' => 'name',                    // the base table field you want to be used as the name
-  );
+  $details = [
+    'relationship_table' => 'contact_relationship',
+    // the name of the _relationship table
+    'base_table' => 'contact',
+    // the name of your chado base table
+    'base_foreign_key' => 'contact_id',
+    // the name of the key in your base chado table
+    'base_key_value' => $contact_id,
+    // the value of example_id for this record
+    'nodetype' => 'contact',
+    // the human-readable name of your node type
+    'cv_id' => $cv_id,
+    // the cv.cv_id of the cv governing contact_relationship.type_id
+    'base_name_field' => 'name',
+    // the base table field you want to be used as the name
+  ];
   // Adds the form elements to your current form
   chado_add_node_form_relationships($form, $form_state, $details);
 
@@ -250,7 +258,7 @@ function chado_contact_validate($node, $form, &$form_state) {
   // Since this validate can be called on AJAX and Deletion of the node
   // we need to make this check to ensure queries are not executed
   // without the proper values.
-  if(property_exists($node, "op") and $node->op != 'Save') {
+  if (property_exists($node, "op") and $node->op != 'Save') {
     return;
   }
 
@@ -266,14 +274,14 @@ function chado_contact_validate($node, $form, &$form_state) {
   // Validating for an update
   if (!is_null($node->nid)) {
     // get the existing node
-    $values = array('contact_id' => $node->contact_id);
-    $result = chado_select_record('contact', array('*'), $values);
+    $values = ['contact_id' => $node->contact_id];
+    $result = chado_select_record('contact', ['*'], $values);
     $contact = $result[0];
 
     // if the name has changed make sure it doesn't conflict with an existing name
     if ($contact->name != $node->contactname) {
-      $values = array('name' => $node->contactname);
-      $result = chado_select_record('contact', array('contact_id'), $values);
+      $values = ['name' => $node->contactname];
+      $result = chado_select_record('contact', ['contact_id'], $values);
       if ($result and count($result) > 0) {
         form_set_error('contactname', 'Cannot update the contact with this contact name. A contact with this name already exists.');
         return;
@@ -283,10 +291,10 @@ function chado_contact_validate($node, $form, &$form_state) {
   // Validating for an insert
   else {
     // The unique constraint for the chado contact table is: name
-    $values = array(
+    $values = [
       'name' => $node->contactname,
-    );
-    $contact = chado_select_record('contact', array('contact_id'), $values);
+    ];
+    $contact = chado_select_record('contact', ['contact_id'], $values);
     if ($contact and count($contact) > 0) {
       form_set_error('contactname', 'Cannot add the contact with this name. A contact with these values already exists.');
       return;
@@ -299,32 +307,33 @@ function chado_contact_validate($node, $form, &$form_state) {
  *
  * This hook allows node modules to limit access to the node types they define.
  *
- *  @param $node
- *  The node on which the operation is to be performed, or, if it does not yet exist, the
- *  type of node to be created
+ * @param $node
+ *  The node on which the operation is to be performed, or, if it does not yet
+ *   exist, the type of node to be created
  *
- *  @param $op
+ * @param $op
  *  The operation to be performed
  *
- *  @param $account
- *  A user object representing the user for whom the operation is to be performed
+ * @param $account
+ *  A user object representing the user for whom the operation is to be
+ *   performed
  *
- *  @return
- *  If the permission for the specified operation is not set then return FALSE. If the
- *  permission is set then return NULL as this allows other modules to disable
- *  access.  The only exception is when the $op == 'create'.  We will always
- *  return TRUE if the permission is set.
+ * @return
+ *  If the permission for the specified operation is not set then return FALSE.
+ *   If the permission is set then return NULL as this allows other modules to
+ *   disable access.  The only exception is when the $op == 'create'.  We will
+ *   always return TRUE if the permission is set.
  *
  * @ingroup tripal_legacy_contact
  */
-function tripal_contact_node_access($node, $op, $account ) {
+function tripal_contact_node_access($node, $op, $account) {
 
   $node_type = $node;
   if (is_object($node)) {
     $node_type = $node->type;
   }
 
-  if($node_type == 'chado_contact') {
+  if ($node_type == 'chado_contact') {
     if ($op == 'create') {
       if (!user_access('create chado_contact content', $account)) {
         return NODE_ACCESS_DENY;
@@ -352,14 +361,15 @@ function tripal_contact_node_access($node, $op, $account ) {
 }
 
 
-
 /**
  * Implements of hook_insert().
  *
- * This function inserts user entered information pertaining to the contact instance into the
- * 'contactauthor', 'contactprop', 'chado_contact', 'contact' talble of the database.
+ * This function inserts user entered information pertaining to the contact
+ * instance into the
+ * 'contactauthor', 'contactprop', 'chado_contact', 'contact' talble of the
+ * database.
  *
- *  @parm $node
+ * @parm $node
  *    Then node which contains the information stored within the node-ID
  *
  * @ingroup tripal_legacy_contact
@@ -377,43 +387,45 @@ function chado_contact_insert($node) {
 
 
     // insert and then get the newly inserted contact record
-    $values = array(
-      'name'           => $node->contactname,
-      'description'    => '',
-      'type_id'        => $node->type_id,
-    );
+    $values = [
+      'name' => $node->contactname,
+      'description' => '',
+      'type_id' => $node->type_id,
+    ];
     $contact = chado_insert_record('contact', $values);
     if (!$contact) {
       drupal_set_message(t('Unable to add contact.', 'warning'));
       tripal_report_error('tripal_contact', TRIPAL_ERROR,
         'Insert contact: Unable to create contact where values: %values',
-        array('%values' => print_r($values, TRUE)));
+        ['%values' => print_r($values, TRUE)]);
       return;
     }
     $contact_id = $contact['contact_id'];
 
-      // Add the description property
+    // Add the description property
     $properties = chado_retrieve_node_form_properties($node);
-    $contact_descrip_id = tripal_get_cvterm(array(
+    $contact_descrip_id = tripal_get_cvterm([
       'name' => 'contact_description',
-      'cv_id' => array('name' =>  'tripal_contact')
-    ));
+      'cv_id' => ['name' => 'tripal_contact'],
+    ]);
     $properties[$contact_descrip_id->cvterm_id][0] = $node->description;
 
     // * Properties Form *
-    $details = array(
+    $details = [
       'property_table' => 'contactprop',
       'base_table' => 'contact',
       'foreignkey_name' => 'contact_id',
-      'foreignkey_value' => $contact_id
-    );
+      'foreignkey_value' => $contact_id,
+    ];
     chado_update_node_form_properties($node, $details, $properties);
 
     // * Relationships Form *
-    $details = array(
-      'relationship_table' => 'contact_relationship',  // name of the _relationship table
-      'foreignkey_value' => $contact_id                // value of the contact_id key
-    );
+    $details = [
+      'relationship_table' => 'contact_relationship',
+      // name of the _relationship table
+      'foreignkey_value' => $contact_id
+      // value of the contact_id key
+    ];
     chado_update_node_form_relationships($node, $details);
   }
   else {
@@ -452,48 +464,50 @@ function chado_contact_update($node) {
   $node->contactname = trim($node->contactname);
   $node->description = trim($node->description['value']);
 
-  $contact_id = chado_get_id_from_nid('contact', $node->nid) ;
+  $contact_id = chado_get_id_from_nid('contact', $node->nid);
 
   // update the contact record
-  $match = array(
+  $match = [
     'contact_id' => $contact_id,
-  );
-  $values = array(
+  ];
+  $values = [
     'name' => $node->contactname,
     'description' => '',
-    'type_id' => $node->type_id
-  );
+    'type_id' => $node->type_id,
+  ];
   $status = chado_update_record('contact', $match, $values);
   if (!$status) {
     drupal_set_message("Error updating contact", "error");
     tripal_report_error('tripal_contact', TRIPAL_ERROR,
-      "Error updating contact", array());
+      "Error updating contact", []);
     return;
   }
 
   // Add the description property
   $properties = chado_retrieve_node_form_properties($node);
-  $contact_descrip_id = tripal_get_cvterm(array(
+  $contact_descrip_id = tripal_get_cvterm([
     'name' => 'contact_description',
-    'cv_id' => array('name' => 'tripal_contact')
-  ));
+    'cv_id' => ['name' => 'tripal_contact'],
+  ]);
   $properties[$contact_descrip_id->cvterm_id][0] = $node->description;
 
   // now add in the properties by first removing any the contact
   // already has and adding the ones we have
-  $details = array(
+  $details = [
     'property_table' => 'contactprop',
     'base_table' => 'contact',
     'foreignkey_name' => 'contact_id',
-    'foreignkey_value' => $contact_id
-  );
+    'foreignkey_value' => $contact_id,
+  ];
   chado_update_node_form_properties($node, $details, $properties);
 
   // * Relationships Form *
-  $details = array(
-    'relationship_table' => 'contact_relationship',  // name of the _relationship table
-    'foreignkey_value' => $contact_id                // value of the contact_id key
-  );
+  $details = [
+    'relationship_table' => 'contact_relationship',
+    // name of the _relationship table
+    'foreignkey_value' => $contact_id
+    // value of the contact_id key
+  ];
   chado_update_node_form_relationships($node, $details);
 }
 
@@ -522,22 +536,22 @@ function chado_contact_load($nodes) {
     }
 
     // get the contact
-    $values = array('contact_id' => $contact_id);
+    $values = ['contact_id' => $contact_id];
     $contact = chado_generate_var('contact', $values);
 
     // get the contact description from the contactprop table and replace
     // the contact.description field with this one (we don't use the contact.description
     // field because it is only 255 characters (too small)).
-    $values = array(
+    $values = [
       'contact_id' => $contact->contact_id,
-      'type_id' => array(
+      'type_id' => [
         'name' => 'contact_description',
-      ),
-    );
-    $options = array(
+      ],
+    ];
+    $options = [
       'return_array' => 1,
-      'include_fk' => array('type_id' => 1),
-    );
+      'include_fk' => ['type_id' => 1],
+    ];
     $description = chado_generate_var('contactprop', $values, $options);
     if (count($description) == 1) {
       $description = chado_expand_var($description, 'field', 'contactprop.value');
@@ -554,11 +568,11 @@ function chado_contact_load($nodes) {
 /**
  * Implements hook_delete().
  *
- * This function takes a node and if the delete button has been chosen by the user, the contact
- * and it's details will be removed.Following,given the node-ID, the instance will be deleted from
- * the 'chado_contact' table.
+ * This function takes a node and if the delete button has been chosen by the
+ * user, the contact and it's details will be removed.Following,given the
+ * node-ID, the instance will be deleted from the 'chado_contact' table.
  *
- *  @parm $node
+ * @parm $node
  *    Then node which contains the information stored within the node-ID
  *
  * @ingroup tripal_legacy_contact
@@ -576,15 +590,15 @@ function chado_contact_delete(&$node) {
   // Remove data from {chado_contact}, {node} and {node_revisions} tables of
   // drupal database
   $sql_del = "DELETE FROM {chado_contact} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
   $sql_del = "DELETE FROM {node_revision} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
   $sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
 
   // Remove data from contact and contactprop tables of chado database as well
-  chado_query("DELETE FROM {contactprop} WHERE contact_id = :contact_id", array(':contact_id' => $contact_id));
-  chado_query("DELETE FROM {contact} WHERE contact_id = :contact_id", array(':contact_id' => $contact_id));
+  chado_query("DELETE FROM {contactprop} WHERE contact_id = :contact_id", [':contact_id' => $contact_id]);
+  chado_query("DELETE FROM {contact} WHERE contact_id = :contact_id", [':contact_id' => $contact_id]);
 }
 
 
@@ -598,39 +612,39 @@ function tripal_contact_node_view($node, $view_mode, $langcode) {
     case 'chado_contact':
       // Show feature browser and counts
       if ($view_mode == 'full') {
-        $node->content['tripal_contact_base'] = array(
+        $node->content['tripal_contact_base'] = [
           '#theme' => 'tripal_contact_base',
           '#node' => $node,
-          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_id' => 'base',
           '#tripal_toc_title' => 'Overview',
           '#weight' => -100,
-        );
-        $node->content['tripal_contact_properties'] = array(
+        ];
+        $node->content['tripal_contact_properties'] = [
           '#theme' => 'tripal_contact_properties',
           '#node' => $node,
-          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_id' => 'properties',
           '#tripal_toc_title' => 'Properties',
-        );
+        ];
         if (module_exists('tripal_pub')) {
-          $node->content['tripal_contact_publications'] = array(
+          $node->content['tripal_contact_publications'] = [
             '#theme' => 'tripal_contact_publications',
             '#node' => $node,
-            '#tripal_toc_id'    => 'publications',
+            '#tripal_toc_id' => 'publications',
             '#tripal_toc_title' => 'Publications',
-          );
+          ];
         }
-        $node->content['tripal_contact_relationships'] = array(
+        $node->content['tripal_contact_relationships'] = [
           '#theme' => 'tripal_contact_relationships',
           '#node' => $node,
-          '#tripal_toc_id'    => 'relationships',
+          '#tripal_toc_id' => 'relationships',
           '#tripal_toc_title' => 'Relationships',
-        );
+        ];
       }
       if ($view_mode == 'teaser') {
-        $node->content['tripal_contact_teaser'] = array(
+        $node->content['tripal_contact_teaser'] = [
           '#theme' => 'tripal_contact_teaser',
           '#node' => $node,
-        );
+        ];
       }
       break;
   }
@@ -650,8 +664,10 @@ function tripal_contact_node_presave($node) {
         // set the title
         $node->title = $node->contactname;
       }
-      else if (property_exists($node, 'contact')) {
-        $node->title = $node->contact->name;
+      else {
+        if (property_exists($node, 'contact')) {
+          $node->title = $node->contact->name;
+        }
       }
       break;
   }
@@ -672,7 +688,7 @@ function tripal_contact_node_insert($node) {
       $contact_id = chado_get_id_from_nid('contact', $node->nid);
 
       // get the contact
-      $values = array('contact_id' => $contact_id);
+      $values = ['contact_id' => $contact_id];
       $contact = chado_generate_var('contact', $values);
       $node->contact = $contact;
 

+ 24 - 24
legacy/tripal_contact/theme/templates/tripal_contact_base.tpl.php

@@ -8,67 +8,67 @@ $contact = $variables['node']->contact; ?>
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
 // This table for the contact has a vertical header (down the first column)
 // so we do not provide headers here, but specify them in the $rows array below.
-$headers = array();
+$headers = [];
 
 // the $rows array contains an array of rows where each row is an array
 // of values for each column of the table in that row.  Additional documentation
 // can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-$rows = array();
+$rows = [];
 
 // Contact Name row
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Name',
     'header' => TRUE,
     'width' => '20%',
-  ),
+  ],
   $contact->name,
-);
+];
 // Contact Type row
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Type',
-    'header' => TRUE
-  ),
+    'header' => TRUE,
+  ],
   $contact->type_id->name,
-);
+];
 // allow site admins to see the contact ID
 if (user_access('view ids')) {
   // Pub ID
-  $rows[] = array(
-    array(
+  $rows[] = [
+    [
       'data' => 'Contact ID',
       'header' => TRUE,
       'class' => 'tripal-site-admin-only-table-row',
-    ),
-    array(
+    ],
+    [
       'data' => $contact->contact_id,
       'class' => 'tripal-site-admin-only-table-row',
-    ),
-  );
+    ],
+  ];
 }
 
 // the $table array contains the headers and rows array as well as other
 // options for controlling the display of the table.  Additional
 // documentation can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-$table = array(
+$table = [
   'header' => $headers,
   'rows' => $rows,
-  'attributes' => array(
+  'attributes' => [
     'id' => 'tripal_contact-table-base',
-    'class' => 'tripal-data-table'
-  ),
+    'class' => 'tripal-data-table',
+  ],
   'sticky' => FALSE,
   'caption' => '',
-  'colgroups' => array(),
+  'colgroups' => [],
   'empty' => '',
-);
+];
 
 // once we have our table array structure defined, we call Drupal's theme_table()
 // function to generate the table.
 print theme_table($table);
 if (property_exists($contact, 'description')) { ?>
-  <div style="text-align: justify"><?php print $contact->description; ?></div> <?php 
+    <div style="text-align: justify"><?php print $contact->description; ?></div> <?php
 } ?>

+ 39 - 19
legacy/tripal_contact/theme/templates/tripal_contact_help.tpl.php

@@ -1,30 +1,50 @@
 <h3>Module Description:</h3>
-<p>The Tripal Contact module is an interface for the Chado Contact module which provides information about
-   people or organizations.  This module provides support for visualization of "contact" pages, editing and updating.
+<p>The Tripal Contact module is an interface for the Chado Contact module which
+    provides information about
+    people or organizations. This module provides support for visualization of
+    "contact" pages, editing and updating.
 </p>
 
 <h3>Setup Instructions:</h3>
 <ol>
-   <li><p><b>Set Permissions</b>: By default only the site administrator account has access to create, edit, delete
-   or administer contacts. Navigate to the <?php print l('permissions page', 'admin/user/permissions')?> and set the
-   permissions under the 'tripal_contact' section as appropriate for your site. For a simple setup, allow anonymous 
-   users access to view content and create a special role for creating, editing and other administrative tasks.</p></li>
- 
- <li><p><b>Create a Contact</b>:  An contact can be <?php print l('created', 'node/add/chado-contact')?> 
- manually in the same way any other data type.  Contacts may also be created automatically by using the 
- publication module publication importers. Alternatively, the Tripal bulk loader may also be used to load contacts.</p></li>
- 
- <li><p><b>Sync any Existing Contacts</b>: Before Contacts can be viewed on the website, they must first be <?php print l('created manually', 'node/add/chado-contact')  ?> 
-          or if they already exist in the Chado database they <?php print l('must be synced', 'admin/tripal/tripal_contact/sync') ?> with Drupal.
-          Once synced, contact pages will appear on the site.</p></li> 
+    <li><p><b>Set Permissions</b>: By default only the site administrator
+            account has access to create, edit, delete
+            or administer contacts. Navigate to
+            the <?php print l('permissions page', 'admin/user/permissions') ?>
+            and set the
+            permissions under the 'tripal_contact' section as appropriate for
+            your site. For a simple setup, allow anonymous
+            users access to view content and create a special role for creating,
+            editing and other administrative tasks.</p></li>
+
+    <li><p><b>Create a Contact</b>: An contact can
+            be <?php print l('created', 'node/add/chado-contact') ?>
+            manually in the same way any other data type. Contacts may also be
+            created automatically by using the
+            publication module publication importers. Alternatively, the Tripal
+            bulk loader may also be used to load contacts.</p></li>
+
+    <li><p><b>Sync any Existing Contacts</b>: Before Contacts can be viewed on
+            the website, they must first
+            be <?php print l('created manually', 'node/add/chado-contact') ?>
+            or if they already exist in the Chado database
+            they <?php print l('must be synced', 'admin/tripal/tripal_contact/sync') ?>
+            with Drupal.
+            Once synced, contact pages will appear on the site.</p></li>
 </ol>
 
 
 <h3>Features of this Module:</h3>
 <ul>
-  <li><p><b>Edit or Delete Contacts</b>: Contacts can be manually edited or deleted by navigating to the map page and clicking the "Edit" button.</p></li>  
-    <li><p><b>Simple Search Tool</b>: A <?php print l('simple search tool','chado/contacts') ?> is provided for 
-    finding contacts. This tool relies on Drupal Views.  <a href="http://drupal.org/project/views">Drupal Views</a>
-    which must be installed to see the search tool.  Look for it in the navigation menu under the item 
-    "Search Data". </p></li>
+    <li><p><b>Edit or Delete Contacts</b>: Contacts can be manually edited or
+            deleted by navigating to the map page and clicking the "Edit"
+            button.</p></li>
+    <li><p><b>Simple Search Tool</b>:
+            A <?php print l('simple search tool', 'chado/contacts') ?> is
+            provided for
+            finding contacts. This tool relies on Drupal Views. <a
+                    href="http://drupal.org/project/views">Drupal Views</a>
+            which must be installed to see the search tool. Look for it in the
+            navigation menu under the item
+            "Search Data". </p></li>
 </ul>

+ 24 - 22
legacy/tripal_contact/theme/templates/tripal_contact_properties.tpl.php

@@ -2,17 +2,17 @@
 
 // expand the contact to include the properties.
 $contact = $variables['node']->contact;
-$contact = chado_expand_var($contact,'table', 'contactprop', array('return_array' => 1));
+$contact = chado_expand_var($contact, 'table', 'contactprop', ['return_array' => 1]);
 $contactprops = $contact->contactprop;
 
 // put the properties in an array so we can remove the contact_description property
-$properties = array();
+$properties = [];
 if ($contactprops) {
   foreach ($contactprops as $property) {
     // we want to keep all properties but the contact_description as that
     // property is shown on the base template page.
-    if($property->type_id->name != 'contact_description') {
-      $property = chado_expand_var($property,'field','contactprop.value');
+    if ($property->type_id->name != 'contact_description') {
+      $property = chado_expand_var($property, 'field', 'contactprop.value');
       $properties[] = $property;
     }
   }
@@ -20,44 +20,46 @@ if ($contactprops) {
 
 
 if (count($properties) > 0) { ?>
-  <div class="tripal_contact-data-block-desc tripal-data-block-desc">Additional information about this contact:</div><?php
+    <div class="tripal_contact-data-block-desc tripal-data-block-desc">
+        Additional information about this contact:
+    </div><?php
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Property Name', 'Value');
-  
+  $headers = ['Property Name', 'Value'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
-  
+  $rows = [];
+
   // add the properties as individual rows
   foreach ($properties as $property) {
-    $rows[] = array(
+    $rows[] = [
       ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-      $property->value
-    );
-  } 
-  
+      $property->value,
+    ];
+  }
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_contact-table-properties',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table); 
+  print theme_table($table);
 }

+ 40 - 35
legacy/tripal_contact/theme/templates/tripal_contact_publications.tpl.php

@@ -2,82 +2,87 @@
 $contact = $variables['node']->contact;
 
 // expand contact to include pubs 
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $contact = chado_expand_var($contact, 'table', 'pubauthor_contact', $options);
-$pubauthor_contacts = $contact->pubauthor_contact; 
+$pubauthor_contacts = $contact->pubauthor_contact;
 
 
 if (count($pubauthor_contacts) > 0) { ?>
-  <div class="tripal_pubauthor_contact-data-block-desc tripal-data-block-desc"></div> <?php 
+    <div class="tripal_pubauthor_contact-data-block-desc tripal-data-block-desc"></div> <?php
 
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Year', 'Publication');
-  
+  $headers = ['Year', 'Publication'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
-  
+  $rows = [];
+
   foreach ($pubauthor_contacts as $pubauthor_contact) {
     $pub = $pubauthor_contact->pubauthor_id->pub_id;
     $pub = chado_expand_var($pub, 'field', 'pub.title');
     $citation = $pub->title;  // use the title as the default citation
-    
+
     // get the citation for this pub if it exists
-    $values = array(
-      'pub_id' => $pub->pub_id, 
-      'type_id' => array(
+    $values = [
+      'pub_id' => $pub->pub_id,
+      'type_id' => [
         'name' => 'Citation',
-      ),
-    );
-    $options = array('return_array' => 1);
-    $citation_prop = chado_generate_var('pubprop', $values, $options); 
+      ],
+    ];
+    $options = ['return_array' => 1];
+    $citation_prop = chado_generate_var('pubprop', $values, $options);
     if (count($citation_prop) == 1) {
       $citation_prop = chado_expand_var($citation_prop, 'field', 'pubprop.value');
       $citation = $citation_prop[0]->value;
     }
-    
+
     // if the publication is synced then link to it
     if ($pub->nid) {
       // replace the title with a link
-      $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
-      $patterns = array(
-        '/(\()/', '/(\))/', 
-        '/(\])/', '/(\[)/',
-        '/(\{)/', '/(\})/',
-        '/(\+)/', '/(\.)/', '/(\?)/', 
-      );
+      $link = l($pub->title, 'node/' . $pub->nid, ['attributes' => ['target' => '_blank']]);
+      $patterns = [
+        '/(\()/',
+        '/(\))/',
+        '/(\])/',
+        '/(\[)/',
+        '/(\{)/',
+        '/(\})/',
+        '/(\+)/',
+        '/(\.)/',
+        '/(\?)/',
+      ];
       $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
       $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
     }
-    
-    $rows[] = array(
+
+    $rows[] = [
       $pub->pyear,
       $citation,
-    );
+    ];
   }
-  
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_contact-table-publications',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table); 
+  print theme_table($table);
 }

+ 103 - 97
legacy/tripal_contact/theme/templates/tripal_contact_relationships.tpl.php

@@ -23,106 +23,112 @@ $object_rels = $all_relationships['object'];
 $subject_rels = $all_relationships['subject'];
 
 if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
-  <div class="tripal_contact-data-block-desc tripal-data-block-desc"></div> <?php
+    <div class="tripal_contact-data-block-desc tripal-data-block-desc"></div> <?php
   // first add in the subject relationships.  
-  foreach ($subject_rels as $rel_type => $rels){
-    foreach ($rels as $obj_type => $objects){ ?>
-      <p>This <?php print strtolower($contact->type_id->name);?>  <b><?php print $rel_type ?></b> with the following <?php print strtolower($obj_type) ?> contact(s): <?php
-       
-      // the $headers array is an array of fields to use as the colum headers.
-      // additional documentation can be found here
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $headers = array('Name');
-      
-      // the $rows array contains an array of rows where each row is an array
-      // of values for each column of the table in that row.  Additional documentation
-      // can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $rows = array();
-      
-      foreach ($objects as $object){
-        // link the contact to it's node
-        $contact_name = $object->record->object_id->name;
-        if (property_exists($object->record, 'nid')) {
-          $contact_name = "<a href=\"" . url("node/" . $object->record->nid) . "\" target=\"_blank\">" . $object->record->object_id->name . "</a>";
-        }
+  foreach ($subject_rels as $rel_type => $rels) {
+    foreach ($rels as $obj_type => $objects) { ?>
+        <p>This <?php print strtolower($contact->type_id->name); ?>
+            <b><?php print $rel_type ?></b> with the
+            following <?php print strtolower($obj_type) ?> contact(s): <?php
 
-        $rows[] = array(
-          $contact_name, 
-        ); 
-       } 
-       // the $table array contains the headers and rows array as well as other
-       // options for controlling the display of the table.  Additional
-       // documentation can be found here:
-       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-       $table = array(
-         'header' => $headers,
-         'rows' => $rows,
-         'attributes' => array(
-           'id' => 'tripal_contact-table-relationship-object',
-           'class' => 'tripal-data-table'
-         ),
-         'sticky' => FALSE,
-         'caption' => '',
-         'colgroups' => array(),
-         'empty' => '',
-       );
-       
-       // once we have our table array structure defined, we call Drupal's theme_table()
-       // function to generate the table.
-       print theme_table($table); ?>
-       </p>
-       <br><?php
-     }
+          // the $headers array is an array of fields to use as the colum headers.
+          // additional documentation can be found here
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $headers = ['Name'];
+
+          // the $rows array contains an array of rows where each row is an array
+          // of values for each column of the table in that row.  Additional documentation
+          // can be found here:
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $rows = [];
+
+          foreach ($objects as $object) {
+            // link the contact to it's node
+            $contact_name = $object->record->object_id->name;
+            if (property_exists($object->record, 'nid')) {
+              $contact_name = "<a href=\"" . url("node/" . $object->record->nid) . "\" target=\"_blank\">" . $object->record->object_id->name . "</a>";
+            }
+
+            $rows[] = [
+              $contact_name,
+            ];
+          }
+          // the $table array contains the headers and rows array as well as other
+          // options for controlling the display of the table.  Additional
+          // documentation can be found here:
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $table = [
+            'header' => $headers,
+            'rows' => $rows,
+            'attributes' => [
+              'id' => 'tripal_contact-table-relationship-object',
+              'class' => 'tripal-data-table',
+            ],
+            'sticky' => FALSE,
+            'caption' => '',
+            'colgroups' => [],
+            'empty' => '',
+          ];
+
+          // once we have our table array structure defined, we call Drupal's theme_table()
+          // function to generate the table.
+          print theme_table($table); ?>
+        </p>
+        <br><?php
+    }
   }
-  
+
   // second add in the object relationships.  
-  foreach ($object_rels as $rel_type => $rels){
-    foreach ($rels as $subject_type => $subjects){?>
-      <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> contact(s) are <?php print $rel_type ?> this <?php print $contact->type_id->name;?>: <?php 
-      // the $headers array is an array of fields to use as the colum headers.
-      // additional documentation can be found here
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $headers = array('Name');
-      
-      // the $rows array contains an array of rows where each row is an array
-      // of values for each column of the table in that row.  Additional documentation
-      // can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $rows = array();
-      
-      foreach ($subjects as $subject){
-        // link the contact to it's node
-        $contact_name = $subject->record->subject_id->name;
-        if (property_exists($subject->record, 'nid')) {
-          $contact_name = "<a href=\"" . url("node/" . $subject->record->nid) . "\" target=\"_blank\">" . $subject->record->subject_id->name . "</a>";
-        }
-        $rows[] = array(
-          $contact_name, 
-        ); 
-       } 
-       // the $table array contains the headers and rows array as well as other
-       // options for controlling the display of the table.  Additional
-       // documentation can be found here:
-       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-       $table = array(
-         'header' => $headers,
-         'rows' => $rows,
-         'attributes' => array(
-           'id' => 'tripal_contact-table-relationship-subject',
-           'class' => 'tripal-data-table'
-         ),
-         'sticky' => FALSE,
-         'caption' => '',
-         'colgroups' => array(),
-         'empty' => '',
-       );
-       
-       // once we have our table array structure defined, we call Drupal's theme_table()
-       // function to generate the table.
-       print theme_table($table); ?>
-       </p>
-       <br><?php
-     }
+  foreach ($object_rels as $rel_type => $rels) {
+    foreach ($rels as $subject_type => $subjects) {
+      ?>
+        <p>The following
+            <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b>
+            contact(s) are <?php print $rel_type ?>
+            this <?php print $contact->type_id->name; ?>: <?php
+          // the $headers array is an array of fields to use as the colum headers.
+          // additional documentation can be found here
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $headers = ['Name'];
+
+          // the $rows array contains an array of rows where each row is an array
+          // of values for each column of the table in that row.  Additional documentation
+          // can be found here:
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $rows = [];
+
+          foreach ($subjects as $subject) {
+            // link the contact to it's node
+            $contact_name = $subject->record->subject_id->name;
+            if (property_exists($subject->record, 'nid')) {
+              $contact_name = "<a href=\"" . url("node/" . $subject->record->nid) . "\" target=\"_blank\">" . $subject->record->subject_id->name . "</a>";
+            }
+            $rows[] = [
+              $contact_name,
+            ];
+          }
+          // the $table array contains the headers and rows array as well as other
+          // options for controlling the display of the table.  Additional
+          // documentation can be found here:
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $table = [
+            'header' => $headers,
+            'rows' => $rows,
+            'attributes' => [
+              'id' => 'tripal_contact-table-relationship-subject',
+              'class' => 'tripal-data-table',
+            ],
+            'sticky' => FALSE,
+            'caption' => '',
+            'colgroups' => [],
+            'empty' => '',
+          ];
+
+          // once we have our table array structure defined, we call Drupal's theme_table()
+          // function to generate the table.
+          print theme_table($table); ?>
+        </p>
+        <br><?php
+    }
   }
 }

+ 15 - 15
legacy/tripal_contact/theme/templates/tripal_contact_teaser.tpl.php

@@ -2,19 +2,19 @@
 $node = $variables['node'];
 $contact = $variables['node']->contact; ?>
 
-<div class="tripal_contact-teaser tripal-teaser"> 
-  <div class="tripal-contact-teaser-title tripal-teaser-title"><?php 
-    print l($node->title, "node/$node->nid", array('html' => TRUE));?>
-  </div>
-  <div class="tripal-contact-teaser-text tripal-teaser-text"><?php 
-    if ($contact->description) {
-      print substr($contact->description, 0, 650);
-      if (strlen($contact->description) > 650) {
-        print "... " . l("[more]", "node/$node->nid");
-      } 
-    } 
-    else {
-      print $node->title; 
-    } ?>
-  </div>
+<div class="tripal_contact-teaser tripal-teaser">
+    <div class="tripal-contact-teaser-title tripal-teaser-title"><?php
+      print l($node->title, "node/$node->nid", ['html' => TRUE]); ?>
+    </div>
+    <div class="tripal-contact-teaser-text tripal-teaser-text"><?php
+      if ($contact->description) {
+        print substr($contact->description, 0, 650);
+        if (strlen($contact->description) > 650) {
+          print "... " . l("[more]", "node/$node->nid");
+        }
+      }
+      else {
+        print $node->title;
+      } ?>
+    </div>
 </div>

+ 23 - 23
legacy/tripal_contact/theme/tripal_contact.theme.inc

@@ -6,22 +6,22 @@
  */
 function tripal_contact_preprocess_tripal_contact_relationships(&$variables) {
   $contact = $variables['node']->contact;
-  
-   // expand the contact object to include the contact relationships.
-  $options = array(
+
+  // expand the contact object to include the contact relationships.
+  $options = [
     'return_array' => 1,
     // we don't want to fully recurse we only need information about the
     // relationship type and the object and subject contacts (including contact type)
-    'include_fk' => array(
+    'include_fk' => [
       'type_id' => 1,
-      'object_id' => array(
+      'object_id' => [
         'type_id' => 1,
-      ),
-      'subject_id'  => array(
+      ],
+      'subject_id' => [
         'type_id' => 1,
-      ),
-    ),
-  );
+      ],
+    ],
+  ];
   $contact = chado_expand_var($contact, 'table', 'contact_relationship', $options);
 
   // get the subject relationships
@@ -29,32 +29,32 @@ function tripal_contact_preprocess_tripal_contact_relationships(&$variables) {
   $orelationships = $contact->contact_relationship->object_id;
 
   // combine both object and subject relationshisp into a single array
-  $relationships = array();
-  $relationships['object'] = array();
-  $relationships['subject'] = array();
+  $relationships = [];
+  $relationships['object'] = [];
+  $relationships['subject'] = [];
 
   // iterate through the object relationships
   if ($orelationships) {
     foreach ($orelationships as $relationship) {
       $rel = new stdClass();
       $rel->record = $relationship;
-       
+
       // get the relationship and child types
       $rel_type = t(preg_replace('/_/', " ", $relationship->type_id->name));
       $child_type = $relationship->subject_id->type_id->name;
-       
+
       // get the node id of the subject
       $sql = "SELECT nid FROM {chado_contact} WHERE contact_id = :contact_id";
-      $n = db_query($sql, array(':contact_id' => $relationship->subject_id->contact_id))->fetchObject();
+      $n = db_query($sql, [':contact_id' => $relationship->subject_id->contact_id])->fetchObject();
       if ($n) {
         $rel->record->nid = $n->nid;
       }
 
       if (!array_key_exists($rel_type, $relationships['object'])) {
-        $relationships['object'][$rel_type] = array();
+        $relationships['object'][$rel_type] = [];
       }
       if (!array_key_exists($child_type, $relationships['object'][$rel_type])) {
-        $relationships['object'][$rel_type][$child_type] = array();
+        $relationships['object'][$rel_type][$child_type] = [];
       }
       $relationships['object'][$rel_type][$child_type][] = $rel;
     }
@@ -67,19 +67,19 @@ function tripal_contact_preprocess_tripal_contact_relationships(&$variables) {
       $rel->record = $relationship;
       $rel_type = t(preg_replace('/_/', " ", $relationship->type_id->name));
       $parent_type = $relationship->object_id->type_id->name;
-       
+
       // get the node id of the subject
       $sql = "SELECT nid FROM {chado_contact} WHERE contact_id = :contact_id";
-      $n = db_query($sql, array(':contact_id' => $relationship->object_id->contact_id))->fetchObject();
+      $n = db_query($sql, [':contact_id' => $relationship->object_id->contact_id])->fetchObject();
       if ($n) {
         $rel->record->nid = $n->nid;
       }
-       
+
       if (!array_key_exists($rel_type, $relationships['subject'])) {
-        $relationships['subject'][$rel_type] = array();
+        $relationships['subject'][$rel_type] = [];
       }
       if (!array_key_exists($parent_type, $relationships['subject'][$rel_type])) {
-        $relationships['subject'][$rel_type][$parent_type] = array();
+        $relationships['subject'][$rel_type][$parent_type] = [];
       }
       $relationships['subject'][$rel_type][$parent_type][] = $rel;
     }

+ 33 - 33
legacy/tripal_contact/tripal_contact.views_default.inc

@@ -12,7 +12,7 @@
  * @ingroup tripal_legacy_contact
  */
 function tripal_contact_views_default_views() {
-  $views = array();
+  $views = [];
 
   // User View ("Search Biological Content")
   // Remember, if you change the name/path of this view,
@@ -48,12 +48,12 @@ function tripal_contact_defaultvalue_user_contacts() {
 
   // Change the path
   $view->display['page_1']->display_options['path'] = 'chado/contact';
-  $view->display['page_1']->display_options['menu'] = array(
+  $view->display['page_1']->display_options['menu'] = [
     'type' => 'normal',
     'title' => 'Contacts',
     'description' => 'Contacts can be persons, institutes, groups, or organizations.',
-    'weight' => '-10'
-  );
+    'weight' => '-10',
+  ];
   unset($view->display['page_1']->display_options['tab_options']);
 
   // Change the permission
@@ -107,48 +107,48 @@ function tripal_contact_defaultview_admin_contacts() {
   $handler->display->display_options['pager']['options']['quantity'] = '9';
   $handler->display->display_options['style_plugin'] = 'table';
   $handler->display->display_options['style_options']['grouping'] = '';
-  $handler->display->display_options['style_options']['columns'] = array(
+  $handler->display->display_options['style_options']['columns'] = [
     'name' => 'name',
     'name_1' => 'name_1',
     'description' => 'description',
-  );
+  ];
   $handler->display->display_options['style_options']['default'] = 'name';
-  $handler->display->display_options['style_options']['info'] = array(
-    'name' => array(
+  $handler->display->display_options['style_options']['info'] = [
+    'name' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'name_1' => array(
+    ],
+    'name_1' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'description' => array(
+    ],
+    'description' => [
       'sortable' => 0,
       'separator' => '',
-    ),
-  );
+    ],
+  ];
   /* Header: Global: Action Links */
   $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
   $handler->display->display_options['header']['action_links_area']['table'] = 'views';
   $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
   $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
   $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
-  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+  $handler->display->display_options['header']['action_links_area']['link-1'] = [
     'label-1' => 'Add Contact',
     'path-1' => 'node/add/tripal-contact',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-2'] = [
     'label-2' => '',
     'path-2' => '',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-3'] = [
     'label-3' => '',
     'path-3' => '',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-4'] = [
     'label-4' => '',
     'path-4' => '',
-  );
+  ];
   /* No results behavior: Global: Text area */
   $handler->display->display_options['empty']['text']['id'] = 'area';
   $handler->display->display_options['empty']['text']['table'] = 'views';
@@ -224,11 +224,11 @@ function tripal_contact_defaultview_admin_contacts() {
   $handler->display->display_options['filters']['type_id']['expose']['label'] = 'Type';
   $handler->display->display_options['filters']['type_id']['expose']['operator'] = 'type_id_op';
   $handler->display->display_options['filters']['type_id']['expose']['identifier'] = 'type_id';
-  $handler->display->display_options['filters']['type_id']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['type_id']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
   /* Filter criterion: Chado Contact: Name */
   $handler->display->display_options['filters']['name']['id'] = 'name';
   $handler->display->display_options['filters']['name']['table'] = 'contact';
@@ -240,11 +240,11 @@ function tripal_contact_defaultview_admin_contacts() {
   $handler->display->display_options['filters']['name']['expose']['label'] = 'Name Contains';
   $handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op';
   $handler->display->display_options['filters']['name']['expose']['identifier'] = 'name';
-  $handler->display->display_options['filters']['name']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['name']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
   /* Filter criterion: Chado Contact: Description */
   $handler->display->display_options['filters']['description']['id'] = 'description';
   $handler->display->display_options['filters']['description']['table'] = 'contact';
@@ -256,11 +256,11 @@ function tripal_contact_defaultview_admin_contacts() {
   $handler->display->display_options['filters']['description']['expose']['label'] = 'Description Contains';
   $handler->display->display_options['filters']['description']['expose']['operator'] = 'description_op';
   $handler->display->display_options['filters']['description']['expose']['identifier'] = 'description';
-  $handler->display->display_options['filters']['description']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['description']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
 
   /** MANUALLY ADD since filter handler no exporting correctly */
   $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
@@ -281,10 +281,10 @@ function tripal_contact_defaultview_admin_contacts() {
   $handler->display->display_options['tab_options']['weight'] = '0';
 
   /** MANUALLY ADD since filter handler no exporting correctly
-  $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
-  $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
-  $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
-  $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
-  */
+   * $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
+   * $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
+   * $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
+   * $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
+   */
   return $view;
 }

File diff suppressed because it is too large
+ 241 - 232
legacy/tripal_core/api/tripal_core.DEPRECATED.inc


+ 281 - 265
legacy/tripal_core/api/tripal_core.chado_nodes.api.inc

@@ -1,35 +1,39 @@
 <?php
 /**
  * @file
- * API to handle much of the common functionality implemented when creating a drupal node type.
+ * API to handle much of the common functionality implemented when creating a
+ *   drupal node type.
  */
 
 /**
  * @defgroup tripal_legacy_chado_node_api Legacy Chado Nodes
  * @ingroup tripal_legacy_api
  * @{
- * Many Tripal modules implement Drupal node types as a means of displaying chado
- * records individually through Drupal as a single web page. In order to do this, many of
- * the same drupal hooks are implemented and the code between modules is actually quite
- * similar. This API aims to abstract much of the common functionality in order to make
- * it easier for new Tripal modules to implement drupal node types and to centralize the
- * maintenance effort as much as possible.
+ * Many Tripal modules implement Drupal node types as a means of displaying
+ *   chado records individually through Drupal as a single web page. In order
+ *   to do this, many of the same drupal hooks are implemented and the code
+ *   between modules is actually quite similar. This API aims to abstract much
+ *   of the common functionality in order to make it easier for new Tripal
+ *   modules to implement drupal node types and to centralize the maintenance
+ *   effort as much as possible.
  *
  * A generic sync form has been created. See chado_node_sync_form() for
  * instructions on how to implement this form in your module.
  *
- * Many of the base chado tables also have associated prop, _dbxref and _relationship
- * tables. Generic mini-forms have been created to help you handle these forms. To
- * implement this functionality you call the mini-form from your module node form and
- * then call the associated update functions from both your hook_insert and hook_update.
- * The functions of interest are as follows:
+ * Many of the base chado tables also have associated prop, _dbxref and
+ *   _relationship tables. Generic mini-forms have been created to help you
+ *   handle these forms. To implement this functionality you call the mini-form
+ *   from your module node form and then call the associated update functions
+ *   from both your hook_insert and hook_update. The functions of interest are
+ *   as follows:
  *   - chado_add_node_form_properties() and chado_update_node_form_properties()
  *     to provide an interface for adding/removing properties
  *   - chado_add_node_form_dbxrefs() and chado_update_node_form_dbxrefs()
- *     to provide an interface for adding/removing additional database references
- *   - chado_add_node_form_relationships() and chado_update_node_form_relationships()
- *     to provide an interface for adding/removing relationships between chado records
- *     from your base table
+ *     to provide an interface for adding/removing additional database
+ *   references
+ *   - chado_add_node_form_relationships() and
+ *   chado_update_node_form_relationships() to provide an interface for
+ *   adding/removing relationships between chado records from your base table
  * @}
  */
 
@@ -60,7 +64,7 @@ function chado_get_id_from_nid($table, $nid, $linking_table = NULL) {
   }
 
   $sql = "SELECT " . $table . "_id as id FROM {$linking_table} WHERE nid = :nid";
-  return db_query($sql, array(':nid' => $nid))->fetchField();
+  return db_query($sql, [':nid' => $nid])->fetchField();
 }
 
 /**
@@ -82,7 +86,7 @@ function chado_get_id_from_nid($table, $nid, $linking_table = NULL) {
  * @return
  *   The nid of the associated node
  *
- *  @ingroup tripal_legacy_chado_node_api
+ * @ingroup tripal_legacy_chado_node_api
  */
 function chado_get_nid_from_id($table, $id, $linking_table = NULL) {
   if (empty($linking_table)) {
@@ -90,7 +94,7 @@ function chado_get_nid_from_id($table, $id, $linking_table = NULL) {
   }
 
   $sql = "SELECT nid FROM {" . $linking_table . "} WHERE " . $table . "_id = :" . $table . "_id";
-  return db_query($sql, array(":" . $table . "_id" => $id))->fetchField();
+  return db_query($sql, [":" . $table . "_id" => $id])->fetchField();
 }
 
 /**
@@ -106,7 +110,7 @@ function chado_get_nid_from_id($table, $id, $linking_table = NULL) {
  * @return
  *    The name of the chado base table for the specified content type
  *
- *  @ingroup tripal_legacy_chado_node_api
+ * @ingroup tripal_legacy_chado_node_api
  */
 function chado_node_get_base_table($content_type, $module = FALSE) {
 
@@ -141,18 +145,19 @@ function chado_node_get_base_table($content_type, $module = FALSE) {
 /**
  * Validate the Triggering element from a node form.
  *
- * We are going to inspect the post to determine what PHP knows is the triggering
- * element and if it doesn't agree with Drupal then we are actually going to
- * change it in Drupal.
+ * We are going to inspect the post to determine what PHP knows is the
+ * triggering element and if it doesn't agree with Drupal then we are actually
+ * going to change it in Drupal.
  *
  * This fixes an obscure bug triggered when a property is added and then
  * a relationship removed, Drupal thinks the first property remove button was
- * clicked and instead removes a property (not a relationship) and renders the new
- * property table in the relationship table page space.
+ * clicked and instead removes a property (not a relationship) and renders the
+ * new property table in the relationship table page space.
  *
  * NOTE: Many Drupal issues state that this problem is solved if the #name
- * of the button is unique (which it is in our case) but we are still experiencing
- * incorrectly determined triggering elements so we need to handle it ourselves.
+ * of the button is unique (which it is in our case) but we are still
+ * experiencing incorrectly determined triggering elements so we need to handle
+ * it ourselves.
  */
 function chado_validate_node_form_triggering_element($form, &$form_state) {
 
@@ -180,7 +185,7 @@ function chado_add_node_form_subtables_add_button_validate($form, &$form_state)
   if (preg_match('/^([a-z]+).*/', $form_state['triggering_element']['#name'], $matches)) {
     $subsection = $matches[1];
 
-    switch($subsection) {
+    switch ($subsection) {
       case 'properties':
         chado_add_node_form_properties_add_button_validate($form, $form_state);
         break;
@@ -209,7 +214,7 @@ function chado_add_node_form_subtables_add_button_submit($form, &$form_state) {
   if (preg_match('/^([a-z]+).*/', $form_state['triggering_element']['#name'], $matches)) {
     $subsection = $matches[1];
 
-     switch($subsection) {
+    switch ($subsection) {
       case 'properties':
         chado_add_node_form_properties_add_button_submit($form, $form_state);
         break;
@@ -232,9 +237,10 @@ function chado_add_node_form_subtables_add_button_submit($form, &$form_state) {
  * Supported subtables: Properties, Relationships, Additional DBxrefs.
  *
  * Since Removing isn't associated with any user input the only thing we
- * need to validate is that Drupal has determined the triggering element correctly.
- * That said, we will call each subtables associated validate function just incase
- * there is some case-specific validation we do not know of or have not anticipated.
+ * need to validate is that Drupal has determined the triggering element
+ * correctly. That said, we will call each subtables associated validate
+ * function just incase there is some case-specific validation we do not know
+ * of or have not anticipated.
  *
  * @param array $form
  * @param array $form_state
@@ -252,7 +258,7 @@ function chado_add_node_form_subtables_remove_button_validate($form, &$form_stat
   if (preg_match('/^([a-z]+).*/', $form_state['triggering_element']['#name'], $matches)) {
     $subsection = $matches[1];
 
-      switch($subsection) {
+    switch ($subsection) {
       case 'properties':
         chado_add_node_form_properties_remove_button_validate($form, $form_state);
         break;
@@ -281,7 +287,7 @@ function chado_add_node_form_subtables_remove_button_submit($form, &$form_state)
   if (preg_match('/^([a-z]+).*/', $form_state['triggering_element']['#name'], $matches)) {
     $subsection = $matches[1];
 
-    switch($subsection) {
+    switch ($subsection) {
       case 'properties':
         chado_add_node_form_properties_remove_button_submit($form, $form_state);
         break;
@@ -318,7 +324,7 @@ function chado_add_node_form_subtable_ajax_update($form, &$form_state) {
   if (preg_match('/^([a-z]+).*/', $form_state['triggering_element']['#name'], $matches)) {
     $subsection = $matches[1];
 
-    switch($subsection) {
+    switch ($subsection) {
       case 'properties':
         return $form['properties']['property_table'];
         break;
@@ -338,83 +344,87 @@ function chado_add_node_form_subtable_ajax_update($form, &$form_state) {
  */
 
 /**
- * Generic Sync Form to aid in sync'ing (create drupal nodes linking to chado content)
- * any chado node type.
+ * Generic Sync Form to aid in sync'ing (create drupal nodes linking to chado
+ * content) any chado node type.
  *
  * To use this you need to add a call to it from your hook_menu() and
- * add some additional information to your hook_node_info(). The Following code gives an
- * example of how this might be done:
+ * add some additional information to your hook_node_info(). The Following code
+ * gives an example of how this might be done:
+ *
  * @code
-
-  function modulename_menu() {
-
-    //  the machine name of your module
-    $module_name = 'tripal_example';
-
-    // the base specified in hook_node_info
-    $node_type = 'chado_example';
-
-    // This menu item will be a tab on the admin/tripal/legacy/tripal_example page
-    // that is not selected by default
-    $items['admin/tripal/legacy/tripal_example/sync'] = array(
-      'title' => ' Sync',
-      'description' => 'Sync examples from Chado with Drupal',
-      'page callback' => 'drupal_get_form',
-      'page arguments' => array('chado_node_sync_form', $module_name, $node_type),
-      'access arguments' => array('administer tripal examples'),
-      'type' => MENU_LOCAL_TASK,
-      'weight' => 0
-    );
-
-    return $items;
-  }
-
-  function modulename_node_info() {
-    return array(
-      'chado_example' => array(
-        'name' => t('example'),
-        'base' => 'chado_example',
-        'description' => t('A Chado example is a collection of material that can be sampled and have experiments performed on it.'),
-        'has_title' => TRUE,
-        'locked' => TRUE,
-
-        // this is what differs from the regular Drupal-documented hook_node_info()
-        'chado_node_api' => array(
-          'base_table' => 'example',            // The name of the chado base table
-          'hook_prefix' => 'chado_example',     // Usually the name of the node type
-          'linking_table' => 'chado_example',   // Specifies the linking table used
-                                                // to map records to Drupal nodes.
-                                                // if 'linking_table' is not specified
-                                                // it defaults to the node_type name.
-          'record_type_title' => array(
-            'singular' => t('Example'),         // Singular human-readable title
-            'plural' => t('Examples')           // Plural human-readable title
-          ),
-          'sync_filters' => array( // filters for syncing
-            'type_id'     => TRUE,     // TRUE if there is an example.type_id field
-            'organism_id' => TRUE,     // TRUE if there is an example.organism_id field
-            'checkboxes'  => array('name')  // If the 'checkboxes' key is present then the
-                                            // value must be an array of column names in
-                                            // base table. The values from these columns will
-                                            // be retreived, contentated with a space delimeter
-                                            // and provided in a list of checkboxes
-                                            // for the user to choose which to sync.
-          ),
-        )
-      ),
-    );
-  }
+ *
+ * function modulename_menu() {
+ *
+ * //  the machine name of your module
+ * $module_name = 'tripal_example';
+ *
+ * // the base specified in hook_node_info
+ * $node_type = 'chado_example';
+ *
+ * // This menu item will be a tab on the admin/tripal/legacy/tripal_example
+ *   page
+ * // that is not selected by default
+ * $items['admin/tripal/legacy/tripal_example/sync'] = array(
+ * 'title' => ' Sync',
+ * 'description' => 'Sync examples from Chado with Drupal',
+ * 'page callback' => 'drupal_get_form',
+ * 'page arguments' => array('chado_node_sync_form', $module_name, $node_type),
+ * 'access arguments' => array('administer tripal examples'),
+ * 'type' => MENU_LOCAL_TASK,
+ * 'weight' => 0
+ * );
+ *
+ * return $items;
+ * }
+ *
+ * function modulename_node_info() {
+ * return array(
+ * 'chado_example' => array(
+ * 'name' => t('example'),
+ * 'base' => 'chado_example',
+ * 'description' => t('A Chado example is a collection of material that can be
+ *   sampled and have experiments performed on it.'),
+ * 'has_title' => TRUE,
+ * 'locked' => TRUE,
+ *
+ * // this is what differs from the regular Drupal-documented hook_node_info()
+ * 'chado_node_api' => array(
+ * 'base_table' => 'example',            // The name of the chado base table
+ * 'hook_prefix' => 'chado_example',     // Usually the name of the node type
+ * 'linking_table' => 'chado_example',   // Specifies the linking table used
+ * // to map records to Drupal nodes.
+ * // if 'linking_table' is not specified
+ * // it defaults to the node_type name.
+ * 'record_type_title' => array(
+ * 'singular' => t('Example'),         // Singular human-readable title
+ * 'plural' => t('Examples')           // Plural human-readable title
+ * ),
+ * 'sync_filters' => array( // filters for syncing
+ * 'type_id'     => TRUE,     // TRUE if there is an example.type_id field
+ * 'organism_id' => TRUE,     // TRUE if there is an example.organism_id field
+ * 'checkboxes'  => array('name')  // If the 'checkboxes' key is present then
+ *   the
+ * // value must be an array of column names in
+ * // base table. The values from these columns will
+ * // be retreived, contentated with a space delimeter
+ * // and provided in a list of checkboxes
+ * // for the user to choose which to sync.
+ * ),
+ * )
+ * ),
+ * );
+ * }
  * @endcode
  *
- * For more information on how you can override some of this behaviour while still
- * benifiting from as much of the common architecture as possible see the following
- * functions: hook_chado_node_sync_create_new_node(), hook_chado_node_sync_form(),
- * hook_chado_node_sync_select_query().
+ * For more information on how you can override some of this behaviour while
+ *   still benifiting from as much of the common architecture as possible see
+ *   the following functions: hook_chado_node_sync_create_new_node(),
+ *   hook_chado_node_sync_form(), hook_chado_node_sync_select_query().
  *
  * @ingroup tripal_legacy_chado_node_api
  */
 function chado_node_sync_form($form, &$form_state) {
-  $form = array();
+  $form = [];
 
   if (isset($form_state['build_info']['args'][0])) {
     $module = $form_state['build_info']['args'][0];
@@ -433,56 +443,56 @@ function chado_node_sync_form($form, &$form_state) {
     $form_state['chado_node_api'] = $args;
   }
 
-  $form['linking_table'] = array(
+  $form['linking_table'] = [
     '#type' => 'hidden',
-    '#value' => $linking_table
-  );
+    '#value' => $linking_table,
+  ];
 
-  $form['node_type'] = array(
+  $form['node_type'] = [
     '#type' => 'hidden',
-    '#value' => $node_type
-  );
+    '#value' => $node_type,
+  ];
 
   // define the fieldsets
-  $form['sync'] = array(
+  $form['sync'] = [
     '#type' => 'fieldset',
     '#title' => 'Sync ' . $args['record_type_title']['plural'],
     '#descrpition' => '',
-  );
-
-  $form['sync']['description'] = array(
-  '#type' => 'item',
-  '#value' => t("%title_plural of the types listed ".
-     "below in the %title_singular Types box will be synced (leave blank to sync all types). You may limit the ".
-     "%title_plural to be synced by a specific organism. Depending on the ".
-     "number of %title_plural in the chado database this may take a long ".
-     "time to complete. ",
-     array(
-      '%title_singular' => $args['record_type_title']['singular'],
-      '%title_plural' => $args['record_type_title']['plural']
-    )),
-  );
+  ];
+
+  $form['sync']['description'] = [
+    '#type' => 'item',
+    '#value' => t("%title_plural of the types listed " .
+      "below in the %title_singular Types box will be synced (leave blank to sync all types). You may limit the " .
+      "%title_plural to be synced by a specific organism. Depending on the " .
+      "number of %title_plural in the chado database this may take a long " .
+      "time to complete. ",
+      [
+        '%title_singular' => $args['record_type_title']['singular'],
+        '%title_plural' => $args['record_type_title']['plural'],
+      ]),
+  ];
 
   if ($args['sync_filters']['type_id']) {
-    $form['sync']['type_ids'] = array(
-      '#title'       => t('%title_singular Types',
-         array(
+    $form['sync']['type_ids'] = [
+      '#title' => t('%title_singular Types',
+        [
           '%title_singular' => $args['record_type_title']['singular'],
-          '%title_plural' => $args['record_type_title']['plural']
-      )),
-      '#type'        => 'textarea',
+          '%title_plural' => $args['record_type_title']['plural'],
+        ]),
+      '#type' => 'textarea',
       '#description' => t("Enter the names of the %title_singular types to sync. " .
-         "Leave blank to sync all %title_plural. Separate each type with a comma ".
-         "or new line. Pages for these %title_singular ".
-         "types will be created automatically for %title_plural that exist in the ".
-         "chado database. The names must match ".
-         "exactly (spelling and case) with terms in the ontologies",
-         array(
+        "Leave blank to sync all %title_plural. Separate each type with a comma " .
+        "or new line. Pages for these %title_singular " .
+        "types will be created automatically for %title_plural that exist in the " .
+        "chado database. The names must match " .
+        "exactly (spelling and case) with terms in the ontologies",
+        [
           '%title_singular' => strtolower($args['record_type_title']['singular']),
-          '%title_plural' => strtolower($args['record_type_title']['plural'])
-        )),
+          '%title_plural' => strtolower($args['record_type_title']['plural']),
+        ]),
       '#default_value' => (isset($form_state['values']['type_id'])) ? $form_state['values']['type_id'] : '',
-    );
+    ];
   }
 
   // get the list of organisms
@@ -493,17 +503,17 @@ function chado_node_sync_form($form, &$form_state) {
     foreach ($results as $organism) {
       $organisms[$organism->organism_id] = "$organism->genus $organism->species ($organism->common_name)";
     }
-    $form['sync']['organism_id'] = array(
-      '#title'       => t('Organism'),
-      '#type'        => t('select'),
+    $form['sync']['organism_id'] = [
+      '#title' => t('Organism'),
+      '#type' => t('select'),
       '#description' => t("Choose the organism for which %title_plural types set above will be synced.",
-         array(
+        [
           '%title_singular' => $args['record_type_title']['singular'],
-          '%title_plural' => $args['record_type_title']['plural']
-        )),
-      '#options'     => $organisms,
+          '%title_plural' => $args['record_type_title']['plural'],
+        ]),
+      '#options' => $organisms,
       '#default_value' => (isset($form_state['values']['organism_id'])) ? $form_state['values']['organism_id'] : 0,
-    );
+    ];
   }
   // get the list of organisms
   if (array_key_exists('checkboxes', $args['sync_filters'])) {
@@ -515,29 +525,29 @@ function chado_node_sync_form($form, &$form_state) {
     // we can't proceed, otherwise, generate the checkboxes
     if (array_key_exists('primary key', $table_info) and count($table_info['primary key']) == 1) {
       $pkey = $table_info['primary key'][0];
-      $columns  = $args['sync_filters']['checkboxes'];
+      $columns = $args['sync_filters']['checkboxes'];
       $select_cols = '';
       foreach ($columns as $column) {
         $select_cols .= $base_table . '.' . $column . "|| ' ' ||";
       }
       // Remove trailing || ' ' ||
       $select_cols = substr($select_cols, 0, -9);
-      $base_table_id  = $base_table . '_id';
+      $base_table_id = $base_table . '_id';
 
-      $select = array($base_table . '.' . $pkey, $select_cols . ' as value');
-      $joins = array();
-      $where_clauses = array();
-      $where_args = array();
+      $select = [$base_table . '.' . $pkey, $select_cols . ' as value'];
+      $joins = [];
+      $where_clauses = [];
+      $where_args = [];
 
       // Allow module to update the query.
       $hook_query_alter = $node_type . '_chado_node_sync_select_query';
       if (function_exists($hook_query_alter)) {
-        $update = call_user_func($hook_query_alter, array(
+        $update = call_user_func($hook_query_alter, [
           'select' => $select,
           'joins' => $joins,
           'where_clauses' => $where_clauses,
           'where_args' => $where_args,
-        ));
+        ]);
         // Now add in any new changes
         if ($update and is_array($update)) {
           $select = $update['select'];
@@ -551,13 +561,13 @@ function chado_node_sync_form($form, &$form_state) {
       // so that if no criteria are specified we only get those items that have not
       // yet been synced.
       $query = "SELECT " . implode(', ', $select) . ' ' .
-               'FROM {' . $base_table . '} ' . $base_table . ' ' . implode(' ', $joins) . ' '.
-               "  LEFT JOIN [" . $linking_table . "] CT ON CT.$base_table_id = $base_table.$base_table_id " .
-               "WHERE CT.$base_table_id IS NULL";
+        'FROM {' . $base_table . '} ' . $base_table . ' ' . implode(' ', $joins) . ' ' .
+        "  LEFT JOIN [" . $linking_table . "] CT ON CT.$base_table_id = $base_table.$base_table_id " .
+        "WHERE CT.$base_table_id IS NULL";
 
       // extend the where clause if needed
       $where = '';
-      $sql_args = array();
+      $sql_args = [];
       foreach ($where_clauses as $category => $items) {
         $where .= ' AND (';
         foreach ($items as $item) {
@@ -574,71 +584,71 @@ function chado_node_sync_form($form, &$form_state) {
       $query .= " ORDER BY $base_table." . implode(", $base_table.", $columns);
       $results = chado_query($query, $sql_args);
 
-      $values = array();
+      $values = [];
       foreach ($results as $result) {
         $values[$result->$pkey] = $result->value;
       }
       if (count($values) > 0) {
-        $form['sync']['ids'] = array(
-          '#title'         => 'Avaliable ' . $args['record_type_title']['plural'],
-          '#type'          => 'checkboxes',
-          '#options'       => $values,
-          '#default_value' => (isset($form_state['values']['ids'])) ? $form_state['values']['ids'] : array(),
-          '#suffix'        => '</div><br>',
-          '#prefix'        => t("The following  %title_plural have not been synced. Check those to be synced or leave all unchecked to sync them all.",
-              array(
+        $form['sync']['ids'] = [
+          '#title' => 'Avaliable ' . $args['record_type_title']['plural'],
+          '#type' => 'checkboxes',
+          '#options' => $values,
+          '#default_value' => (isset($form_state['values']['ids'])) ? $form_state['values']['ids'] : [],
+          '#suffix' => '</div><br>',
+          '#prefix' => t("The following  %title_plural have not been synced. Check those to be synced or leave all unchecked to sync them all.",
+              [
                 '%title_singular' => strtolower($args['record_type_title']['singular']),
-                '%title_plural'   => strtolower($args['record_type_title']['plural'])
-              )) . '<div style="height: 200px; overflow: scroll">',
-        );
+                '%title_plural' => strtolower($args['record_type_title']['plural']),
+              ]) . '<div style="height: 200px; overflow: scroll">',
+        ];
       }
       else {
-        $form['sync']['no_ids'] = array(
-          '#markup' => "<p>There are no " .  strtolower($args['record_type_title']['plural']) . " to sync.</p>",
-        );
+        $form['sync']['no_ids'] = [
+          '#markup' => "<p>There are no " . strtolower($args['record_type_title']['plural']) . " to sync.</p>",
+        ];
       }
     }
   }
   // if we provide a list of checkboxes we shouldn't need a max_sync
   else {
-    $form['sync']['max_sync'] = array(
+    $form['sync']['max_sync'] = [
       '#type' => 'textfield',
       '#title' => t('Maximum number of records to Sync'),
       '#description' => t('Leave this field empty to sync all records, regardless of number'),
       '#default_value' => (isset($form_state['values']['max_sync'])) ? $form_state['values']['max_sync'] : '',
-    );
+    ];
   }
 
-  $form['sync']['button'] = array(
+  $form['sync']['button'] = [
     '#type' => 'submit',
     '#value' => t('Sync ' . $args['record_type_title']['plural']),
     '#weight' => 3,
-  );
+  ];
 
 
-  $form['cleanup'] = array(
+  $form['cleanup'] = [
     '#type' => 'fieldset',
-    '#title' => t('Clean Up')
-  );
-  $form['cleanup']['description'] = array(
+    '#title' => t('Clean Up'),
+  ];
+  $form['cleanup']['description'] = [
     '#markup' => t("<p>With Drupal and chado residing in different databases " .
-        "it is possible that nodes in Drupal and " . strtolower($args['record_type_title']['plural']) . " in Chado become " .
-        "\"orphaned\".  This can occur if a node in Drupal is " .
-        "deleted but the corresponding chado records is not and/or vice " .
-        "versa. Click the button below to resolve these discrepancies.</p>"),
+      "it is possible that nodes in Drupal and " . strtolower($args['record_type_title']['plural']) . " in Chado become " .
+      "\"orphaned\".  This can occur if a node in Drupal is " .
+      "deleted but the corresponding chado records is not and/or vice " .
+      "versa. Click the button below to resolve these discrepancies.</p>"),
     '#weight' => -10,
-  );
-  $form['cleanup']['cleanup_batch_size'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Batch Size'),
-      '#description' => t('The number of records to analyze together in a batch. If you are having memory issues you might want to decrease this number.'),
-      '#default_value' => variable_get('chado_node_api_cleanup_batch_size', 25000),
-  );
-  $form['cleanup']['button'] = array(
+  ];
+  $form['cleanup']['cleanup_batch_size'] = [
+    '#type' => 'textfield',
+    '#title' => t('Batch Size'),
+    '#description' => t('The number of records to analyze together in a batch. If you are having memory issues you might want to decrease this number.'),
+    '#default_value' => variable_get('chado_node_api_cleanup_batch_size', 25000),
+  ];
+  $form['cleanup']['button'] = [
     '#type' => 'submit',
     '#value' => 'Clean up orphaned ' . strtolower($args['record_type_title']['plural']),
     '#weight' => 2,
-  );
+  ];
 
   // Allow each module to alter this form as needed
   $hook_form_alter = $args['hook_prefix'] . '_chado_node_sync_form';
@@ -693,13 +703,13 @@ function chado_node_sync_form_submit($form, $form_state) {
     }
 
     // Get the types separated into a consistent string
-    $types = array();
+    $types = [];
     if (isset($form_state['values']['type_ids'])) {
       // seperate by new line or comma.
       $temp_types = preg_split("/[,\n\r]+/", $form_state['values']['type_ids']);
 
       // remove any extra spacing around the types
-      for($i = 0; $i < count($temp_types); $i++) {
+      for ($i = 0; $i < count($temp_types); $i++) {
         // skip empty types
         if (trim($temp_types[$i]) == '') {
           continue;
@@ -709,8 +719,8 @@ function chado_node_sync_form_submit($form, $form_state) {
     }
 
     // Get the ids to be synced
-    $ids = array();
-    if (array_key_exists('ids', $form_state['values'])){
+    $ids = [];
+    if (array_key_exists('ids', $form_state['values'])) {
       foreach ($form_state['values']['ids'] as $id => $selected) {
         if ($selected) {
           $ids[] = $id;
@@ -720,20 +730,20 @@ function chado_node_sync_form_submit($form, $form_state) {
 
     // get the organism to be synced
     $organism_id = FALSE;
-    if (array_key_exists('organism_id',  $form_state['values'])) {
+    if (array_key_exists('organism_id', $form_state['values'])) {
       $organism_id = $form_state['values']['organism_id'];
     }
 
     // Job Arguments
-    $job_args = array(
+    $job_args = [
       'base_table' => $base_table,
       'max_sync' => (!empty($form_state['values']['max_sync'])) ? $form_state['values']['max_sync'] : FALSE,
       'organism_id' => $organism_id,
       'types' => $types,
       'ids' => $ids,
       'linking_table' => $linking_table,
-      'node_type' => $node_type
-    );
+      'node_type' => $node_type,
+    ];
 
     $title = "Sync " . $args['record_type_title']['plural'];
     tripal_add_job($title, $module, 'chado_node_sync_records', $job_args, $user->uid);
@@ -743,7 +753,12 @@ function chado_node_sync_form_submit($form, $form_state) {
     $base_table = $form_state['chado_node_api']['base_table'];
     $linking_table = $form_state['values']['linking_table'];
     $node_type = $form_state['values']['node_type'];
-    $job_args = array($base_table, $form_state['values']['cleanup_batch_size'], $linking_table, $node_type);
+    $job_args = [
+      $base_table,
+      $form_state['values']['cleanup_batch_size'],
+      $linking_table,
+      $node_type,
+    ];
     variable_set('chado_node_api_cleanup_batch_size', $form_state['values']['cleanup_batch_size']);
     tripal_add_job($form_state['values']['op'], $module, 'chado_cleanup_orphaned_nodes', $job_args, $user->uid);
   }
@@ -755,7 +770,8 @@ function chado_node_sync_form_submit($form, $form_state) {
  * @param $base_table
  *   The name of the Chado table containing the record that should be synced
  * @param $max_sync
- *   Optional: A numeric value to indicate the maximum number of records to sync.
+ *   Optional: A numeric value to indicate the maximum number of records to
+ *   sync.
  * @param $organism_id
  *   Optional: Limit the list of records to be synced to only those that
  *   are associated with this organism_id. If the record is not assocaited
@@ -784,8 +800,8 @@ function chado_node_sync_form_submit($form, $form_state) {
  * @ingroup tripal_legacy_chado_node_api
  */
 function chado_node_sync_records($base_table, $max_sync = FALSE,
-    $organism_id = FALSE, $types = array(), $ids = array(),
-    $linking_table = FALSE, $node_type = FALSE, $job_id = NULL) {
+                                 $organism_id = FALSE, $types = [], $ids = [],
+                                 $linking_table = FALSE, $node_type = FALSE, $job_id = NULL) {
 
   global $user;
   $base_table_id = $base_table . '_id';
@@ -800,20 +816,20 @@ function chado_node_sync_records($base_table, $max_sync = FALSE,
   print "\nSync'ing $base_table records.  ";
 
   // START BUILDING QUERY TO GET ALL RECORD FROM BASE TABLE THAT MATCH
-  $select = array("$base_table.*");
-  $joins = array();
-  $where_clauses = array();
-  $where_args = array();
+  $select = ["$base_table.*"];
+  $joins = [];
+  $where_clauses = [];
+  $where_args = [];
 
   // If types are supplied then handle them
   $restrictions = '';
   if (count($types) > 0) {
-    $restrictions .= "  Type(s): " . implode(', ',$types) . "\n";
+    $restrictions .= "  Type(s): " . implode(', ', $types) . "\n";
 
     $select[] = 'cvterm.name as cvtname';
     $joins[] = "LEFT JOIN {cvterm} cvterm ON $base_table.type_id = cvterm.cvterm_id";
     foreach ($types as $type) {
-      $sanitized_type = str_replace(' ','_',$type);
+      $sanitized_type = str_replace(' ', '_', $type);
       $where_clauses['type'][] = "cvterm.name = :type_name_$sanitized_type";
       $where_args['type'][":type_name_$sanitized_type"] = $type;
     }
@@ -830,7 +846,7 @@ function chado_node_sync_records($base_table, $max_sync = FALSE,
 
   // If Organism is supplied
   if ($organism_id) {
-    $organism = chado_select_record('organism', array('*'), array('organism_id' => $organism_id));
+    $organism = chado_select_record('organism', ['*'], ['organism_id' => $organism_id]);
     $restrictions .= "  Organism: " . $organism[0]->genus . " " . $organism[0]->species . "\n";
 
     $select[] = 'organism.*';
@@ -842,12 +858,12 @@ function chado_node_sync_records($base_table, $max_sync = FALSE,
   // Allow module to add to query
   $hook_query_alter = $node_type . '_chado_node_sync_select_query';
   if (function_exists($hook_query_alter)) {
-    $update = call_user_func($hook_query_alter, array(
+    $update = call_user_func($hook_query_alter, [
       'select' => $select,
       'joins' => $joins,
       'where_clauses' => $where_clauses,
       'where_args' => $where_args,
-    ));
+    ]);
     // Now add in any new changes
     if ($update and is_array($update)) {
       $select = $update['select'];
@@ -861,13 +877,13 @@ function chado_node_sync_records($base_table, $max_sync = FALSE,
   // yet been synced.
   $query = "
     SELECT " . implode(', ', $select) . ' ' .
-    'FROM {' . $base_table . '} ' . $base_table . ' ' . implode(' ', $joins) . ' '.
+    'FROM {' . $base_table . '} ' . $base_table . ' ' . implode(' ', $joins) . ' ' .
     "  LEFT JOIN [" . $linking_table . "] CT ON CT.$base_table_id = $base_table.$base_table_id " .
     "WHERE CT.$base_table_id IS NULL ";
 
   // extend the where clause if needed
   $where = '';
-  $sql_args = array();
+  $sql_args = [];
   foreach ($where_clauses as $category => $items) {
     $where .= ' AND (';
     foreach ($items as $item) {
@@ -911,8 +927,8 @@ function chado_node_sync_records($base_table, $max_sync = FALSE,
   $i = 0;
   $transaction = db_transaction();
   print "\nNOTE: Syncing is performed using a database transaction. \n" .
-      "If the sync fails or is terminated prematurely then the entire set of \n" .
-      "synced items is rolled back and will not be found in the database\n\n";
+    "If the sync fails or is terminated prematurely then the entire set of \n" .
+    "synced items is rolled back and will not be found in the database\n\n";
   try {
     $percent = 0;
     foreach ($results as $record) {
@@ -920,13 +936,13 @@ function chado_node_sync_records($base_table, $max_sync = FALSE,
       if ($job_id and $i % $interval == 0) {
         $percent = sprintf("%.2f", (($i + 1) / $count) * 100);
         print "Syncing $base_table " . ($i + 1) . " of $count (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes.\r";
-        tripal_set_job_progress($job_id, intval(($i/$count)*100));
+        tripal_set_job_progress($job_id, intval(($i / $count) * 100));
       }
 
       // Check if the record is already in the chado linking table
       // (ie: check to see if it is already linked to a node).
       $result = db_select($linking_table, 'lnk')
-        ->fields('lnk',array('nid'))
+        ->fields('lnk', ['nid'])
         ->condition($base_table_id, $record->{$base_table_id}, '=')
         ->execute()
         ->fetchObject();
@@ -948,8 +964,8 @@ function chado_node_sync_records($base_table, $max_sync = FALSE,
         }
 
         // Validate and Save New Node
-        $form = array();
-        $form_state = array();
+        $form = [];
+        $form_state = [];
         node_validate($new_node, $form, $form_state);
 
         if (!form_get_errors()) {
@@ -959,15 +975,13 @@ function chado_node_sync_records($base_table, $max_sync = FALSE,
           node_save($node);
         }
         else {
-          throw new Exception(t("Failed to insert $base_table: %title", array('%title' => $new_node->title)));
+          throw new Exception(t("Failed to insert $base_table: %title", ['%title' => $new_node->title]));
         }
       }
       $i++;
     }
     print "\n\nComplete!\n";
-  }
-
-  catch (Exception $e) {
+  } catch (Exception $e) {
     $transaction->rollback();
     print "\n"; // make sure we start errors on new line
     watchdog_exception('trp-fsync', $e);
@@ -1001,7 +1015,7 @@ function chado_node_sync_records($base_table, $max_sync = FALSE,
  * @ingroup tripal_legacy_chado_node_api
  */
 function chado_cleanup_orphaned_nodes($table, $nentries = 25000,
-    $linking_table = NULL, $node_type = NULL, $job_id = NULL) {
+                                      $linking_table = NULL, $node_type = NULL, $job_id = NULL) {
 
   // The max number of records either as nodes or linked records.
   $count = 0;
@@ -1019,10 +1033,10 @@ function chado_cleanup_orphaned_nodes($table, $nentries = 25000,
   // Find the number nodes of type chado_$table and find the number of entries
   // in chado_$table; keep the larger of the two numbers.
   $dsql = "SELECT COUNT(*) FROM {node} WHERE type = :node_type";
-  $ndat = db_query($dsql, array(':node_type' => $node_type));
+  $ndat = db_query($dsql, [':node_type' => $node_type]);
   $temp = $ndat->fetchObject();
   $ncount = $temp->count;
-  $clsql= "SELECT COUNT(*) FROM {" . $linking_table . "}";
+  $clsql = "SELECT COUNT(*) FROM {" . $linking_table . "}";
   $cdat = db_query($clsql);
   $clcount = $cdat->fetchObject();
   if ($ncount < $clcount) {
@@ -1041,10 +1055,9 @@ function chado_cleanup_orphaned_nodes($table, $nentries = 25000,
     for ($i = 0; $i < $m; $i++) {
       $offset = ($nentries * $i);
       chado_cleanup_orphaned_nodes_part($table, $job_id, $nentries, $offset,
-          $linking_table, $node_type);
+        $linking_table, $node_type);
     }
-  }
-  catch (Exception $e) {
+  } catch (Exception $e) {
     $transaction->rollback();
     print "\n"; // make sure we start errors on new line
     watchdog_exception('trp-fsync', $e);
@@ -1067,15 +1080,15 @@ function chado_cleanup_orphaned_nodes($table, $nentries = 25000,
  * @ingroup tripal_legacy_chado_node_api
  */
 function chado_cleanup_orphaned_nodes_part($table, $job_id = NULL, $nentries,
-    $offset, $linking_table, $node_type) {
+                                           $offset, $linking_table, $node_type) {
 
   $count = 0;
 
   // Retrieve all of the entries in the linker table for a given node type
   // and place into an array.
   print "Verifying $linking_table records...\n";
-  $cnodes = array();
-  $clsql= "
+  $cnodes = [];
+  $clsql = "
     SELECT *
     FROM {" . $linking_table . "} LT
     ORDER BY LT.nid LIMIT $nentries OFFSET $offset";
@@ -1104,23 +1117,26 @@ function chado_cleanup_orphaned_nodes_part($table, $job_id = NULL, $nentries,
 
       // See if the node exits, if not remove the entry from linking table table.
       $nsql = "SELECT * FROM {node} WHERE nid = :nid AND type = :node_type";
-      $results = db_query($nsql, array(':nid' => $linker->nid, ':node_type' => $node_type));
+      $results = db_query($nsql, [
+        ':nid' => $linker->nid,
+        ':node_type' => $node_type,
+      ]);
       $node = $results->fetchObject();
       if (!$node) {
         $deleted++;
-        db_query("DELETE FROM {" . $linking_table . "} WHERE nid = :nid", array(':nid' => $linker->nid));
+        db_query("DELETE FROM {" . $linking_table . "} WHERE nid = :nid", [':nid' => $linker->nid]);
         //print "$linking_table missing node.... DELETING where nid=".$linker->nid." $linking_table entry.\n";
       }
 
       // Does record in chado exists, if not remove entry from $linking_table.
       $table_id = $table . "_id";
       $lsql = "SELECT * FROM {" . $table . "} where " . $table_id . " = :chado_id";
-      $results = chado_query($lsql, array(":chado_id" => $linker->$table_id));
+      $results = chado_query($lsql, [":chado_id" => $linker->$table_id]);
       $record = $results->fetchObject();
       if (!$record) {
         $deleted++;
         $sql = "DELETE FROM {" . $linking_table . "} WHERE " . $table_id . " = :chado_id";
-        db_query($sql, array(":chado_id" => $linker->$table_id));
+        db_query($sql, [":chado_id" => $linker->$table_id]);
         //print "$linking_table missing $table.... DELETING where $table_id=".$linker->$table_id." $linking_table entry.\n";
       }
       $i++;
@@ -1141,8 +1157,8 @@ function chado_cleanup_orphaned_nodes_part($table, $job_id = NULL, $nentries,
     LIMIT $nentries OFFSET $offset
   ";
 
-  $dsql_args = array(':node_type' => $node_type);
-  $nodes = array();
+  $dsql_args = [':node_type' => $node_type];
+  $nodes = [];
   $res = db_query($dsql, $dsql_args);
   $count = 0;
   foreach ($res as $node) {
@@ -1169,21 +1185,21 @@ function chado_cleanup_orphaned_nodes_part($table, $job_id = NULL, $nentries,
 
       // check to see if the node has a corresponding entry
       // in the $linking_table table. If not then delete the node.
-       $csql = "SELECT * FROM {" . $linking_table . "} WHERE nid = :nid ";
-       $results = db_query($csql, array(':nid' => $node->nid));
-       $link = $results->fetchObject();
-       if (!$link) {
-         // Checking node_access creates a memory leak. Commenting out for now
-         // assuming that this code can only be run by a site administrator
-         // anyway.
-//         if (node_access('delete', $node)) {
-           $deleted++;
-           node_delete($node->nid);
-//         }
-//         else {
-//           print "\nNode missing in $linking_table table.... but cannot delete due to improper permissions (node $node->nid)\n";
-//         }
-       }
+      $csql = "SELECT * FROM {" . $linking_table . "} WHERE nid = :nid ";
+      $results = db_query($csql, [':nid' => $node->nid]);
+      $link = $results->fetchObject();
+      if (!$link) {
+        // Checking node_access creates a memory leak. Commenting out for now
+        // assuming that this code can only be run by a site administrator
+        // anyway.
+        //         if (node_access('delete', $node)) {
+        $deleted++;
+        node_delete($node->nid);
+        //         }
+        //         else {
+        //           print "\nNode missing in $linking_table table.... but cannot delete due to improper permissions (node $node->nid)\n";
+        //         }
+      }
       $i++;
     }
     $percent = sprintf("%.2f", ($i / $count) * 100);
@@ -1201,9 +1217,9 @@ function chado_cleanup_orphaned_nodes_part($table, $job_id = NULL, $nentries,
  * Note: For your own module, replace hook in the function name with the
  * machine-name of your chado node type (ie: chado_feature).
  *
- * @param $new_node:
+ * @param $new_node :
  *   a basic new node object
- * @param $record:
+ * @param $record :
  *   the record object from chado specifying the biological data for this node
  *
  * @return
@@ -1257,11 +1273,11 @@ function hook_chado_node_sync_form($form, &$form_state) {
  *
  * @ingroup tripal_legacy_chado_node_api
  */
-function hook_chado_node_sync_form_submit ($form, $form_state) {
+function hook_chado_node_sync_form_submit($form, $form_state) {
 
   global $user;
 
-  $job_args = array(
+  $job_args = [
     // The base chado table (ie: feature).
     $base_table,
     // The maximum number of records to sync or FALSE for sync all that match.
@@ -1269,12 +1285,12 @@ function hook_chado_node_sync_form_submit ($form, $form_state) {
     // The organism_id to restrict records to or FALSE if not to restrict by organism_id.
     $organism_id,
     // A string with the cvterm.name of the types to restrict to separated by |||
-    $types
-  );
+    $types,
+  ];
 
   // You should register a tripal job
   tripal_add_job(
-    // The title of the job -be descriptive.
+  // The title of the job -be descriptive.
     $title,
     // The name of your module.
     $module,

+ 278 - 252
legacy/tripal_core/api/tripal_core.chado_nodes.dbxrefs.api.inc

@@ -6,91 +6,105 @@
  *
  * How To Use:
  * @code
-
-  function chado_example_form($form, &$form_state) {
-
-    // Default values for form elements can come in the following ways:
-    //
-    // 1) as elements of the $node object.  This occurs when editing an existing node
-    // 2) in the $form_state['values'] array which occurs on a failed validation or
-    //    ajax callbacks when the ajax call originates from non-submit fields other
-    //    than button
-    // 3) in the $form_state['input'] array which occurs on ajax callbacks from submit
-    //    form elements (e.g. buttons) and the form is being rebuilt but has not yet
-    //    been validated
-    //
-    // The reference elements added by this function do use AJAX calls from buttons,
-    // therefore, it is important to check for form values in the $form_state['values']
-    // for case #2 above, and in the $form_state['input'] for case #3.
-    // See the chado analysis node form for an example.
-
-
-    // Next, add in all the form array definition particular to your node type
-
-    // To add in the additional database reference form elements, you first need to prepare the arguments
-    // for the function call.
-
-    $details = array(
-      'linking_table' => 'example_dbxref',         // the name of the table linking additional dbxrefs to this node
-      'base_foreign_key' => 'example_id',          // key to link to the chado content created by this node
-      'base_key_value' => $example_id,             // the value of the above key
-      'fieldset_title' => 'Additional References', // the non-translated title for this fieldset
-      'additional_instructions' => ''              // a non-stranslated string providing additional instructions
-    );
-
-    // Finally, and add the additional form elements to the form
-    chado_add_node_form_dbxrefs($form, $form_state, $details);
-
-    return $form;
-  }
-
-  function chado_example_insert($node) {
-
-    // if there is an example_id in the $node object then this must be a sync so
-    // we can skip adding the chado_example as it is already there, although
-    // we do need to proceed with the rest of the insert
-    if (!property_exists($node, 'example_id')) {
-
-      // Add record to chado example table
-
-      // Add to any other tables needed
-
-      // Add all additional database references
-      // This function will create new database references as needed and select existing ones.
-      // Existing _dbxref links will be cleared and then re-added
-      chado_update_node_form_dbxrefs(
-        $node,              // the node object passed in via hook_insert()
-        'example_dbxref',   // the name of the _dbxref linking table
-        'example_id',       // key to link to the chado content created by this node
-        $node->example_id   // value of the above key
-      );
-    }
-
-    // Add record to chado_example linking example_id to new node
-
-  }
-
-  function chado_example_update($node) {
-
-
-      // Update record in chado example table
-
-      // Update any other tables needed
-
-      // Update all additional database references
-      // This function will create new database references as needed and select existing ones.
-      // Existing _dbxref links will be cleared and then re-added
-      chado_update_node_form_dbxrefs(
-        $node,              // the node object passed in via hook_insert()
-        'example_dbxref',   // the name of the _dbxref linking table
-        'example_id',       // key to link to the chado content created by this node
-        $node->example_id   // value of the above key
-      );
-
-    // Don't need to update chado_example linking table since niether example_id or nid can be changed in update
-
-  }
-
+ *
+ * function chado_example_form($form, &$form_state) {
+ *
+ * // Default values for form elements can come in the following ways:
+ * //
+ * // 1) as elements of the $node object.  This occurs when editing an existing
+ *   node
+ * // 2) in the $form_state['values'] array which occurs on a failed validation
+ *   or
+ * //    ajax callbacks when the ajax call originates from non-submit fields
+ *   other
+ * //    than button
+ * // 3) in the $form_state['input'] array which occurs on ajax callbacks from
+ *   submit
+ * //    form elements (e.g. buttons) and the form is being rebuilt but has not
+ *   yet
+ * //    been validated
+ * //
+ * // The reference elements added by this function do use AJAX calls from
+ *   buttons,
+ * // therefore, it is important to check for form values in the
+ *   $form_state['values']
+ * // for case #2 above, and in the $form_state['input'] for case #3.
+ * // See the chado analysis node form for an example.
+ *
+ *
+ * // Next, add in all the form array definition particular to your node type
+ *
+ * // To add in the additional database reference form elements, you first need
+ *   to prepare the arguments
+ * // for the function call.
+ *
+ * $details = array(
+ * 'linking_table' => 'example_dbxref',         // the name of the table
+ *   linking additional dbxrefs to this node
+ * 'base_foreign_key' => 'example_id',          // key to link to the chado
+ *   content created by this node
+ * 'base_key_value' => $example_id,             // the value of the above key
+ * 'fieldset_title' => 'Additional References', // the non-translated title for
+ *   this fieldset
+ * 'additional_instructions' => ''              // a non-stranslated string
+ *   providing additional instructions
+ * );
+ *
+ * // Finally, and add the additional form elements to the form
+ * chado_add_node_form_dbxrefs($form, $form_state, $details);
+ *
+ * return $form;
+ * }
+ *
+ * function chado_example_insert($node) {
+ *
+ * // if there is an example_id in the $node object then this must be a sync so
+ * // we can skip adding the chado_example as it is already there, although
+ * // we do need to proceed with the rest of the insert
+ * if (!property_exists($node, 'example_id')) {
+ *
+ * // Add record to chado example table
+ *
+ * // Add to any other tables needed
+ *
+ * // Add all additional database references
+ * // This function will create new database references as needed and select
+ *   existing ones.
+ * // Existing _dbxref links will be cleared and then re-added
+ * chado_update_node_form_dbxrefs(
+ * $node,              // the node object passed in via hook_insert()
+ * 'example_dbxref',   // the name of the _dbxref linking table
+ * 'example_id',       // key to link to the chado content created by this node
+ * $node->example_id   // value of the above key
+ * );
+ * }
+ *
+ * // Add record to chado_example linking example_id to new node
+ *
+ * }
+ *
+ * function chado_example_update($node) {
+ *
+ *
+ * // Update record in chado example table
+ *
+ * // Update any other tables needed
+ *
+ * // Update all additional database references
+ * // This function will create new database references as needed and select
+ *   existing ones.
+ * // Existing _dbxref links will be cleared and then re-added
+ * chado_update_node_form_dbxrefs(
+ * $node,              // the node object passed in via hook_insert()
+ * 'example_dbxref',   // the name of the _dbxref linking table
+ * 'example_id',       // key to link to the chado content created by this node
+ * $node->example_id   // value of the above key
+ * );
+ *
+ * // Don't need to update chado_example linking table since niether example_id
+ *   or nid can be changed in update
+ *
+ * }
  * @endcode
  *
  * @ingroup tripal_legacy_chado_node_api
@@ -110,15 +124,18 @@
  *   The corresponding form_state array for the form
  * @param $details
  *   An array defining details needed by this form. Required Keys are:
- *     - linking_table: the name of the dbxref linking table (ie: feature_dbxref)
- *     - base_foreign_key: the name of the foreign key linking this table to the non-dbxref table (ie: feature_id)
- *     - base_key_value: the value of the base_foreign_key for the current form (ie: 999 if the feature_id=999)
- *   Optional keys include:
+ *     - linking_table: the name of the dbxref linking table (ie:
+ *   feature_dbxref)
+ *     - base_foreign_key: the name of the foreign key linking this table to
+ *   the non-dbxref table (ie: feature_id)
+ *     - base_key_value: the value of the base_foreign_key for the current form
+ *   (ie: 999 if the feature_id=999) Optional keys include:
  *     - fieldset_title: the non-translated title for this fieldset
- *     - additional_instructions: a non-translated string providing additional instructions
+ *     - additional_instructions: a non-translated string providing additional
+ *   instructions
  *     - select_options: must be an array where the [key] is a valid db_id and
- *       the [value] is the human-readable name of the option. This includes all databases
- *       in the chado db table by default
+ *       the [value] is the human-readable name of the option. This includes
+ *   all databases in the chado db table by default
  *
  * @ingroup tripal_legacy_chado_node_api
  */
@@ -135,10 +152,10 @@ function chado_add_node_form_dbxrefs(&$form, &$form_state, $details) {
   }
   else {
     // get the list of databases from the db table
-    $db_options = array(0 => 'Select a Database');
-    $options = array('order_by' => array('name' => 'ASC'));
-    $select = chado_select_record('db', array('db_id','name'), array(), $options);
-    foreach($select as $db) {
+    $db_options = [0 => 'Select a Database'];
+    $options = ['order_by' => ['name' => 'ASC']];
+    $select = chado_select_record('db', ['db_id', 'name'], [], $options);
+    foreach ($select as $db) {
       $db_options[$db->db_id] = $db->name;
     }
   }
@@ -151,23 +168,23 @@ function chado_add_node_form_dbxrefs(&$form, &$form_state, $details) {
   $tripal_message = tripal_set_message(
     t('To add databases to the drop down list, you need to <a href="@dblink">add
       an external database reference</a>.',
-      array(
-        '@dblink' => url('admin/tripal/legacy/tripal_db/add')
-      )
+      [
+        '@dblink' => url('admin/tripal/legacy/tripal_db/add'),
+      ]
     ),
     $importance,
-    array('return_html' => TRUE)
+    ['return_html' => TRUE]
   );
 
   // Group all of the chado node api fieldsets into vertical tabs.
-  $form['chado_node_api'] = array(
+  $form['chado_node_api'] = [
     '#type' => 'vertical_tabs',
-    '#attached' => array(
-      'css' => array(
+    '#attached' => [
+      'css' => [
         'chado-node-api' => drupal_get_path('module', 'tripal_core') . '/theme/css/chado_node_api.css',
-      ),
-    ),
-  );
+      ],
+    ],
+  ];
 
   // the fieldset of the dbxref elements
   $instructions = 'To add an external reference, select the database you want to reference from the
@@ -177,47 +194,47 @@ function chado_add_node_form_dbxrefs(&$form, &$form_state, $details) {
     depending upon what is available. To remove incorrect references, click the
     "Remove" button. Note: you cannot edit previously added references but instead
     need to remove and re-add them.';
-  $form['addtl_dbxrefs'] = array(
+  $form['addtl_dbxrefs'] = [
     '#type' => 'fieldset',
     '#title' => t($details['fieldset_title']),
     '#description' => t('<p><strong>Indicate that this %nodetype either originates from
-      or is present in another database.</strong></p><p>'. $instructions . $details['additional_instructions'] . '</p>',
-      array('%nodetype' => $details['nodetype'])),
+      or is present in another database.</strong></p><p>' . $instructions . $details['additional_instructions'] . '</p>',
+      ['%nodetype' => $details['nodetype']]),
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
     '#group' => 'chado_node_api',
-    '#weight'      => 9,
-    '#attributes' => array('class' => array('chado-node-api','dbxrefs')),
-    '#attached' => array(
-      'js' => array(
+    '#weight' => 9,
+    '#attributes' => ['class' => ['chado-node-api', 'dbxrefs']],
+    '#attached' => [
+      'js' => [
         'chado-node-api-vertical-tabs' => drupal_get_path('module', 'tripal_core') . '/theme/js/chadoNodeApi_updateVerticalTabSummary.js',
-      ),
-    ),
-  );
+      ],
+    ],
+  ];
 
   // this form element is a tree, so that we don't puke all of the values into then node variable
   // it is set as a tree, and keeps them in the $form_state['values']['dbxref_table'] heading.
-  $form['addtl_dbxrefs']['dbxref_table'] = array(
+  $form['addtl_dbxrefs']['dbxref_table'] = [
     '#type' => 'markup',
     '#tree' => TRUE,
     '#prefix' => '<div id="tripal-generic-edit-addtl_dbxrefs-table">',
     '#suffix' => '</div>',
-    '#theme' => 'chado_node_additional_dbxrefs_form_table'
-  );
+    '#theme' => 'chado_node_additional_dbxrefs_form_table',
+  ];
 
   // We need to provide feedback to the user that changes made
   // are not saved until the node is saved.
-  $form['addtl_dbxrefs']['dbxref_table']['save_warning'] = array(
+  $form['addtl_dbxrefs']['dbxref_table']['save_warning'] = [
     '#type' => 'markup',
     '#prefix' => '<div id="dbxref-save-warning" class="messages warning" style="display:none;">',
     '#suffix' => '</div>',
     '#markup' => '* The changes to these references will not be saved until the "Save" button at the bottom of this form is clicked. <span class="specific-changes"></span>',
-    '#attached' => array(
-      'js' => array(
+    '#attached' => [
+      'js' => [
         'chado-node-api-unsaved' => drupal_get_path('module', 'tripal_core') . '/theme/js/chadoNodeApi_unsavedNotify.js',
-      ),
-    ),
-  );
+      ],
+    ],
+  ];
 
   /* DBxrefs can come to us in two ways:
    *
@@ -243,10 +260,10 @@ function chado_add_node_form_dbxrefs(&$form, &$form_state, $details) {
          dbxref.version
        FROM {dbxref} dbxref
          LEFT JOIN {db} db ON db.db_id = dbxref.db_id
-         LEFT JOIN {".$details['linking_table']."} linking_table ON linking_table.dbxref_id = dbxref.dbxref_id
-       WHERE linking_table.".$details['base_foreign_key']."= :base_key_value
+         LEFT JOIN {" . $details['linking_table'] . "} linking_table ON linking_table.dbxref_id = dbxref.dbxref_id
+       WHERE linking_table." . $details['base_foreign_key'] . "= :base_key_value
        ORDER BY db.name ASC, dbxref.version ASC",
-       array(':base_key_value' => $details['base_key_value'])
+      [':base_key_value' => $details['base_key_value']]
     );
   }
   /* The format of the $existing_dbxref's array is either:
@@ -290,66 +307,66 @@ function chado_add_node_form_dbxrefs(&$form, &$form_state, $details) {
 
       $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['#type'] = 'markup';
       $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['#value'] = '';
-      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['#attributes'] = array(
-        'class' => array('dbxref', 'saved')
-      );
+      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['#attributes'] = [
+        'class' => ['dbxref', 'saved'],
+      ];
 
       // Determine whether this dbxref is unsaved or not.
       // We can tell this by looking at the dbxref_id: if it's not
       // saved yet we will have entered a TEMP###.
       if (preg_match('/^TEMP/', $dbxref->dbxref_id)) {
-        $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['#attributes'] = array(
-          'class' => array('dbxref', 'unsaved')
-        );
+        $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['#attributes'] = [
+          'class' => ['dbxref', 'unsaved'],
+        ];
       }
 
-      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['db_id'] = array(
+      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['db_id'] = [
         '#type' => 'hidden',
-        '#value' => $dbxref->db_id
-      );
+        '#value' => $dbxref->db_id,
+      ];
 
-      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['accession'] = array(
+      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['accession'] = [
         '#type' => 'hidden',
-        '#value' => $dbxref->accession
-      );
+        '#value' => $dbxref->accession,
+      ];
 
-      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['version'] = array(
+      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['version'] = [
         '#type' => 'hidden',
         '#value' => $dbxref->version,
-      );
+      ];
 
-      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['dbxref_id'] = array(
+      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['dbxref_id'] = [
         '#type' => 'hidden',
-        '#value' => $dbxref->dbxref_id
-      );
+        '#value' => $dbxref->dbxref_id,
+      ];
 
-      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['db'] = array(
+      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['db'] = [
         '#type' => 'markup',
         '#markup' => $dbxref->db_name,
-        '#prefix' => '<span class="row-unsaved-warning"></span>'
-      );
+        '#prefix' => '<span class="row-unsaved-warning"></span>',
+      ];
 
-      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['dbxref_version'] = array(
+      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['dbxref_version'] = [
         '#type' => 'markup',
         '#markup' => $dbxref->version,
-      );
+      ];
 
-      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['dbxref_accession'] = array(
+      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['dbxref_accession'] = [
         '#type' => 'markup',
-        '#markup' => $dbxref->accession
-      );
+        '#markup' => $dbxref->accession,
+      ];
       // remove button
-      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['dbxref_action'] = array(
+      $form['addtl_dbxrefs']['dbxref_table'][$dbxref->db_id][$dbxref->dbxref_id]['dbxref_action'] = [
         '#type' => 'submit',
         '#value' => t('Remove'),
-        '#name' => "dbxrefs_remove-".$dbxref->db_id.'-'.$dbxref->dbxref_id,
-        '#ajax' => array(
+        '#name' => "dbxrefs_remove-" . $dbxref->db_id . '-' . $dbxref->dbxref_id,
+        '#ajax' => [
           'callback' => "chado_add_node_form_subtable_ajax_update",
           'wrapper' => 'tripal-generic-edit-addtl_dbxrefs-table',
-          'effect'   => 'fade',
-          'method'   => 'replace',
-          'prevent'  => 'click'
-        ),
+          'effect' => 'fade',
+          'method' => 'replace',
+          'prevent' => 'click',
+        ],
         // When this button is clicked, the form will be validated and submitted.
         // Therefore, we set custom submit and validate functions to override the
         // default node form submit.  In the validate function we validate only the
@@ -357,60 +374,61 @@ function chado_add_node_form_dbxrefs(&$form, &$form_state, $details) {
         // from the chado_additional_dbxrefs array. In order to keep validate errors
         // from the node form validate and Drupal required errors for non-dbxref fields
         // preventing the user from removing dbxrefs we set the #limit_validation_errors below
-        '#validate' => array('chado_add_node_form_subtables_remove_button_validate'),
-        '#submit' => array('chado_add_node_form_subtables_remove_button_submit'),
+        '#validate' => ['chado_add_node_form_subtables_remove_button_validate'],
+        '#submit' => ['chado_add_node_form_subtables_remove_button_submit'],
         // Limit the validation of the form upon clicking this button to the dbxref_table tree
         // No other fields will be validated (ie: no fields from the main form or any other api
         // added form).
-        '#limit_validation_errors' => array(
-          array('dbxref_table')  // Validate all fields within $form_state['values']['dbxref_table']
-        )
-      );
+        '#limit_validation_errors' => [
+          ['dbxref_table']
+          // Validate all fields within $form_state['values']['dbxref_table']
+        ],
+      ];
     }
   }
 
   // Quickly add a hidden field stating how many dbxrefs are currently added.
-  $form['addtl_dbxrefs']['num_dbxrefs'] = array(
+  $form['addtl_dbxrefs']['num_dbxrefs'] = [
     '#type' => 'hidden',
     '#value' => $num_dbxrefs,
-    '#attributes' => array('class' => 'num-dbxrefs')
-  );
+    '#attributes' => ['class' => 'num-dbxrefs'],
+  ];
 
   // Form elements for adding a new dbxref
   //---------------------------------------------
-  $form['addtl_dbxrefs']['dbxref_table']['new'] = array(
+  $form['addtl_dbxrefs']['dbxref_table']['new'] = [
     '#type' => 'markup',
     '#prefix' => '<span class="addtl-dbxrefs-add-new-dbxref">',
-    '#suffix' => '</span>'
-  );
+    '#suffix' => '</span>',
+  ];
 
   // add in the existing databases
-  $form['addtl_dbxrefs']['dbxref_table']['new']['db'] = array(
+  $form['addtl_dbxrefs']['dbxref_table']['new']['db'] = [
     '#type' => 'select',
     '#options' => $db_options,
-  );
+  ];
 
-  $form['addtl_dbxrefs']['dbxref_table']['new']['dbxref_accession'] = array(
+  $form['addtl_dbxrefs']['dbxref_table']['new']['dbxref_accession'] = [
     '#type' => 'textfield',
-  );
+  ];
 
-  $form['addtl_dbxrefs']['dbxref_table']['new']['dbxref_version'] = array(
+  $form['addtl_dbxrefs']['dbxref_table']['new']['dbxref_version'] = [
     '#type' => 'textfield',
     '#size' => 10,
-  );
+  ];
 
   // add button
-  $form['addtl_dbxrefs']['dbxref_table']['new']['dbxref_action'] = array(
+  $form['addtl_dbxrefs']['dbxref_table']['new']['dbxref_action'] = [
     '#type' => 'submit',
     '#value' => t('Add'),
     '#name' => "dbxrefs-add",
-    '#ajax' => array(
+    '#ajax' => [
       'callback' => "chado_add_node_form_subtable_ajax_update",
       'wrapper' => 'tripal-generic-edit-addtl_dbxrefs-table',
-      'effect'   => 'fade',
-      'method'   => 'replace',
-      'prevent'  => 'click'
-    ),
+      'effect' => 'fade',
+      'method' => 'replace',
+      'prevent' => 'click',
+    ],
     // When this button is clicked, the form will be validated and submitted.
     // Therefore, we set custom submit and validate functions to override the
     // default node form submit.  In the validate function we validate only the
@@ -418,20 +436,21 @@ function chado_add_node_form_dbxrefs(&$form, &$form_state, $details) {
     // array. In order to keep validate errors from the node form validate and Drupal
     // required errors for non-dbxref fields preventing the user from adding dbxrefs we
     // set the #limit_validation_errors below
-    '#validate' => array('chado_add_node_form_subtables_add_button_validate'),
-    '#submit' => array('chado_add_node_form_subtables_add_button_submit'),
+    '#validate' => ['chado_add_node_form_subtables_add_button_validate'],
+    '#submit' => ['chado_add_node_form_subtables_add_button_submit'],
     // Limit the validation of the form upon clicking this button to the dbxref_table tree
     // No other fields will be validated (ie: no fields from the main form or any other api
     // added form).
-    '#limit_validation_errors' => array(
-      array('dbxref_table')  // Validate all fields within $form_state['values']['dbxref_table']
-    )
-  );
+    '#limit_validation_errors' => [
+      ['dbxref_table']
+      // Validate all fields within $form_state['values']['dbxref_table']
+    ],
+  ];
 
-  $form['addtl_dbxrefs']['admin_message'] = array(
+  $form['addtl_dbxrefs']['admin_message'] = [
     '#type' => 'markup',
-    '#markup' => $tripal_message
-  );
+    '#markup' => $tripal_message,
+  ];
 }
 
 /**
@@ -443,8 +462,8 @@ function chado_add_node_form_dbxrefs_add_button_validate($form, &$form_state) {
   // Ensure the db_id is supplied & Valid
   $db = chado_select_record(
     'db',
-    array('db_id', 'name'),
-    array('db_id' => $form_state['values']['dbxref_table']['new']['db'])
+    ['db_id', 'name'],
+    ['db_id' => $form_state['values']['dbxref_table']['new']['db']]
   );
   if (!isset($db[0])) {
     form_set_error('dbxref_table][new][db', 'Please select a database before attempting to add a new database reference.');
@@ -455,7 +474,7 @@ function chado_add_node_form_dbxrefs_add_button_validate($form, &$form_state) {
 
   // Ensure accession is supplied
   if (empty($form_state['values']['dbxref_table']['new']['dbxref_accession'])) {
-    form_set_error('dbxref_table][new][dbxref_accession','You must enter the accession before attempting to add a new database reference.');
+    form_set_error('dbxref_table][new][dbxref_accession', 'You must enter the accession before attempting to add a new database reference.');
   }
 
 }
@@ -463,8 +482,8 @@ function chado_add_node_form_dbxrefs_add_button_validate($form, &$form_state) {
 /**
  * Called by the add button in chado_add_node_form_dbxrefs
  *
- * Create an array of additional dbxrefs in the form state. This array will then be
- * used to rebuild the form in subsequent builds
+ * Create an array of additional dbxrefs in the form state. This array will
+ * then be used to rebuild the form in subsequent builds
  *
  */
 function chado_add_node_form_dbxrefs_add_button_submit($form, &$form_state) {
@@ -476,13 +495,13 @@ function chado_add_node_form_dbxrefs_add_button_submit($form, &$form_state) {
   }
 
   // get details for the new dbxref
-  $dbxref = array(
+  $dbxref = [
     'db_id' => $form_state['values']['dbxref_table']['new']['db'],
     'db_name' => $form_state['values']['dbxref_table']['new']['db_name'],
     'dbxref_id' => 'TEMP' . uniqid(),
     'version' => $form_state['values']['dbxref_table']['new']['dbxref_version'],
     'accession' => $form_state['values']['dbxref_table']['new']['dbxref_accession'],
-  );
+  ];
   $key = $dbxref['db_id'] . '-' . $dbxref['dbxref_id'];
   $form_state['chado_additional_dbxrefs'][$key] = (object) $dbxref;
 
@@ -516,7 +535,7 @@ function chado_add_node_form_dbxrefs_remove_button_submit(&$form, &$form_state)
   }
 
   // remove the specified dbxref from the form dbxref table
-  if(preg_match('/dbxrefs_remove-([^-]+-[^-]+)/',$form_state['triggering_element']['#name'],$match)) {
+  if (preg_match('/dbxrefs_remove-([^-]+-[^-]+)/', $form_state['triggering_element']['#name'], $match)) {
     $key = $match[1];
     if (array_key_exists($key, $form_state['chado_additional_dbxrefs'])) {
       unset($form_state['chado_additional_dbxrefs'][$key]);
@@ -525,16 +544,18 @@ function chado_add_node_form_dbxrefs_remove_button_submit(&$form, &$form_state)
 }
 
 /**
- * Creates an array in form_state containing the existing addtl_dbxrefs. This array is
- * then modified by the add/remove buttons and used as a source for rebuilding the form.
- * This function get's called at each button (add and remove) button submits the first
- * time one of the button's is clicked to instantiates the $form_state['chado_additional_dbxrefs'] array
+ * Creates an array in form_state containing the existing addtl_dbxrefs. This
+ * array is then modified by the add/remove buttons and used as a source for
+ * rebuilding the form. This function get's called at each button (add and
+ * remove) button submits the first time one of the button's is clicked to
+ * instantiates the $form_state['chado_additional_dbxrefs'] array
  *
  * $form_state['chado_additional_dbxrefs'] = array(
  *   '[db_id]-[version]' => array(
  *     'db_id' => [the db.db_id value]
  *     'db_name' => [the db.name value]
- *     'dbxref_id' => [the dbxref.dbxref_id value, or temporary value if it doesn't yet exists],
+ *     'dbxref_id' => [the dbxref.dbxref_id value, or temporary value if it
+ * doesn't yet exists],
  *     'version' => [the dbxref.version value],
  *     'accession' => [the dbxref.accession value],
  *   ),
@@ -543,21 +564,21 @@ function chado_add_node_form_dbxrefs_remove_button_submit(&$form, &$form_state)
  */
 function chado_add_node_form_dbxrefs_create_dbxref_formstate_array($form, &$form_state) {
 
-  $form_state['chado_additional_dbxrefs'] = array();
+  $form_state['chado_additional_dbxrefs'] = [];
 
   foreach (element_children($form['addtl_dbxrefs']['dbxref_table']) as $db_id) {
     if ($db_id != 'new') {
       foreach (element_children($form['addtl_dbxrefs']['dbxref_table'][$db_id]) as $version) {
-          $element = $form['addtl_dbxrefs']['dbxref_table'][$db_id][$version];
-          $dbxref = array(
-            'db_id' => $element['db_id']['#value'],
-            'db_name' => $element['db']['#markup'],
-            'dbxref_id' => $element['dbxref_id']['#value'],
-            'version' => $element['dbxref_version']['#markup'],
-            'accession' => $element['dbxref_accession']['#markup'],
-          );
-          $key = $dbxref['db_id'] . '-' . $dbxref['dbxref_id'];
-          $form_state['chado_additional_dbxrefs'][$key] = (object) $dbxref;
+        $element = $form['addtl_dbxrefs']['dbxref_table'][$db_id][$version];
+        $dbxref = [
+          'db_id' => $element['db_id']['#value'],
+          'db_name' => $element['db']['#markup'],
+          'dbxref_id' => $element['dbxref_id']['#value'],
+          'version' => $element['dbxref_version']['#markup'],
+          'accession' => $element['dbxref_accession']['#markup'],
+        ];
+        $key = $dbxref['db_id'] . '-' . $dbxref['dbxref_id'];
+        $form_state['chado_additional_dbxrefs'][$key] = (object) $dbxref;
       }
     }
   }
@@ -570,29 +591,29 @@ function chado_add_node_form_dbxrefs_create_dbxref_formstate_array($form, &$form
 function theme_chado_add_node_form_dbxrefs_table($variables) {
   $element = $variables['element'];
 
-  $header = array(
+  $header = [
     'db' => t('Database'),
     'dbxref_accession' => t('Accession'),
     'dbxref_version' => t('Version'),
     'dbxref_action' => t('Actions'),
-  );
+  ];
 
-  $rows = array();
+  $rows = [];
   foreach (element_children($element) as $db_id) {
     if ($db_id == 'new') {
-      $row = array();
+      $row = [];
 
-        $row['data'] = array();
-        foreach ($header as $fieldname => $title) {
-          $row['data'][] = drupal_render($element[$db_id][$fieldname]);
-        }
-        $rows[] = $row;
+      $row['data'] = [];
+      foreach ($header as $fieldname => $title) {
+        $row['data'][] = drupal_render($element[$db_id][$fieldname]);
+      }
+      $rows[] = $row;
     }
     else {
       foreach (element_children($element[$db_id]) as $version) {
-        $row = array();
+        $row = [];
 
-        $row['data'] = array();
+        $row['data'] = [];
         $row['class'] = $element[$db_id][$version]['#attributes']['class'];
         foreach ($header as $fieldname => $title) {
           $row['data'][] = drupal_render($element[$db_id][$version][$fieldname]);
@@ -602,31 +623,31 @@ function theme_chado_add_node_form_dbxrefs_table($variables) {
     }
   }
 
-  return render($element['save_warning']) . theme('table', array(
-    'header' => $header,
-    'rows' => $rows
-  ));
+  return render($element['save_warning']) . theme('table', [
+      'header' => $header,
+      'rows' => $rows,
+    ]);
 }
 
 /**
  * This function is used in a hook_insert, hook_update for a node form
- * when the additional_dbxrefs form has been added to the form.  It retrieves all of the dbxrefs
- * and returns them in an array of the format:
+ * when the additional_dbxrefs form has been added to the form.  It retrieves
+ * all of the dbxrefs and returns them in an array of the format:
  *
  *   $dbxefs[<db_id>][<version>][<dbxref_id>] = <accession>
  *
- * This array can then be used for inserting or updating dbxrefs using the API call
- * tripal_hook_insert_dbxref()
+ * This array can then be used for inserting or updating dbxrefs using the API
+ * call tripal_hook_insert_dbxref()
  *
  * @param $node
  *
  * @return
  *   A dbxref array
  *
- *  @ingroup tripal_legacy_chado_node_api
+ * @ingroup tripal_legacy_chado_node_api
  */
 function chado_retrieve_node_form_dbxrefs($node) {
-  $dbxrefs = array();
+  $dbxrefs = [];
 
   if (isset($node->dbxref_table)) {
     foreach ($node->dbxref_table as $db_id => $elements) {
@@ -643,18 +664,23 @@ function chado_retrieve_node_form_dbxrefs($node) {
 }
 
 /**
- * This function is used in hook_insert or hook_update and handles inserting of any new
- * dbxrefs and creation of links between those dbxrefs and node content
+ * This function is used in hook_insert or hook_update and handles inserting of
+ * any new dbxrefs and creation of links between those dbxrefs and node content
  *
  * @param $node
  *    The node passed into hook_insert & hook_update
  * @param $details
- *   - linking_table: the name of the _dbxref linking table (ie: feature_dbxref)
- *   - foreignkey_name: the name of the foreign key used to link to the node content (ie: feature_id)
- *   - foreignkey_value: the value of the foreign key (ie: 445, if there exists a feature where feature_id=445)
+ *   - linking_table: the name of the _dbxref linking table (ie:
+ *   feature_dbxref)
+ *   - foreignkey_name: the name of the foreign key used to link to the node
+ *   content (ie: feature_id)
+ *   - foreignkey_value: the value of the foreign key (ie: 445, if there exists
+ *   a feature where feature_id=445)
  * @param $retrieved_dbxrefs
- *   An array of databa references from chado_retrieve_node_form_dbxrefs($node).
- *   This can be used if you need special handling for some of the database references
+ *   An array of databa references from
+ *   chado_retrieve_node_form_dbxrefs($node).
+ *   This can be used if you need special handling for some of the database
+ *   references
  *
  * @ingroup tripal_legacy_chado_node_api
  */
@@ -666,7 +692,7 @@ function chado_update_node_form_dbxrefs($node, $details, $retrieved_dbxrefs = FA
 
   if (isset($node->dbxref_table) AND ($foreignkey_value > 0)) {
     // First remove existing dbxref links
-    chado_delete_record($linking_table, array($foreignkey_name => $foreignkey_value));
+    chado_delete_record($linking_table, [$foreignkey_name => $foreignkey_value]);
 
     // Add back in dbxref links and insert dbxrefs as needed
     if ($retrieved_dbxrefs) {
@@ -679,14 +705,14 @@ function chado_update_node_form_dbxrefs($node, $details, $retrieved_dbxrefs = FA
       foreach ($versions as $version => $elements) {
         foreach ($elements as $dbxref_id => $accession) {
           // If there is no dbxref then we have to create that first
-          if (preg_match('/^TEMP/',$dbxref_id)) {
+          if (preg_match('/^TEMP/', $dbxref_id)) {
             $version = ($version == 'NONE') ? '' : $version;
-            $success = tripal_insert_dbxref(array(
+            $success = tripal_insert_dbxref([
               'db_id' => $db_id,
               'accession' => $accession,
               'version' => $version,
-              'description' => NULL
-            ));
+              'description' => NULL,
+            ]);
             if ($success) {
               $dbxref_id = $success->dbxref_id;
             }
@@ -697,13 +723,13 @@ function chado_update_node_form_dbxrefs($node, $details, $retrieved_dbxrefs = FA
 
           // add _dbxref linker
           if ($dbxref_id) {
-            if (preg_match('/(\w+)_dbxref/',$linking_table,$matches)) {
+            if (preg_match('/(\w+)_dbxref/', $linking_table, $matches)) {
               $base_table = $matches[1];
 
               $success_link = tripal_associate_dbxref(
                 $base_table,
                 $foreignkey_value,
-                array('dbxref_id' => $dbxref_id)
+                ['dbxref_id' => $dbxref_id]
               );
             }
           }

File diff suppressed because it is too large
+ 312 - 285
legacy/tripal_core/api/tripal_core.chado_nodes.properties.api.inc


File diff suppressed because it is too large
+ 330 - 299
legacy/tripal_core/api/tripal_core.chado_nodes.relationships.api.inc


File diff suppressed because it is too large
+ 340 - 302
legacy/tripal_core/api/tripal_core.chado_nodes.title_and_path.inc


+ 9 - 8
legacy/tripal_core/api/tripal_core.tripal_variables.api.inc

@@ -48,8 +48,8 @@ function tripal_add_node_variable($nid, $name, $value, $rank = 0) {
       // rank is already used then don't continue.
       if ($rank > 0 and $rank == $value->rank) {
         tripal_report_error('tripal_core', TRIPAL_ERROR,
-            "The rank for the term, '$term', is already used for node $nid. " .
-            "Cannot add the variable.", array());
+          "The rank for the term, '$term', is already used for node $nid. " .
+          "Cannot add the variable.", []);
         return FALSE;
       }
       if ($value->rank > $max_rank) {
@@ -61,13 +61,13 @@ function tripal_add_node_variable($nid, $name, $value, $rank = 0) {
 
   // Add the new variable.
   $node_variable_id = db_insert('tripal_node_variables')
-    ->fields(array(
+    ->fields([
       'variable_id' => $variable->variable_id,
       'nid' => $nid,
       'value' => $value,
-      'rank' => $rank
-     ))
-     ->execute();
+      'rank' => $rank,
+    ])
+    ->execute();
   return $node_variable_id;
 }
 
@@ -84,11 +84,12 @@ function tripal_add_node_variable($nid, $name, $value, $rank = 0) {
  *   Optional.  The name of the variable.
  * @param $rank
  *   Optional.  The rank of the variable to retreive.
+ *
  * @return
  *   An array of variable objects.
  */
 function tripal_get_node_variables($nid, $name = '', $rank = '') {
-  $variables = array();
+  $variables = [];
   if (!$nid) {
     return $variables;
   }
@@ -105,7 +106,7 @@ function tripal_get_node_variables($nid, $name = '', $rank = '') {
   $results = $query->execute();
 
   // Build the  variables array and return it.
-  while($variable = $results->fetchObject()) {
+  while ($variable = $results->fetchObject()) {
     $variables[] = $variable;
   }
   return $variables;

+ 39 - 39
legacy/tripal_core/includes/tripal_core.form_elements.inc

@@ -10,24 +10,24 @@
  * @ingroup tripal_legacy_core
  */
 function tripal_core_element_info() {
-  $elements = array();
+  $elements = [];
 
-  $elements['file_upload_combo'] = array(
+  $elements['file_upload_combo'] = [
     '#input' => TRUE,
-    '#process' => array('expand_file_upload_combo'),
-    '#value_callback' =>'file_upload_combo_value_callback',
+    '#process' => ['expand_file_upload_combo'],
+    '#value_callback' => 'file_upload_combo_value_callback',
     '#theme' => 'theme_file_upload_combo',
-    '#theme_wrappers' => array('form_element'),
-  );
+    '#theme_wrappers' => ['form_element'],
+  ];
 
-  $elements['sequence_combo'] = array(
+  $elements['sequence_combo'] = [
     '#input' => TRUE,
-    '#process' => array('expand_sequence_combo'),
+    '#process' => ['expand_sequence_combo'],
     '#value_callback' => 'sequence_combo_value_callback',
     '#theme' => 'theme_sequence_combo',
-    '#theme_wrappers' => array('form_element'),
+    '#theme_wrappers' => ['form_element'],
     '#tree' => TRUE,
-  );
+  ];
 
   return $elements;
 }
@@ -41,11 +41,11 @@ function expand_file_upload_combo($element, $form_state, $complete_form) {
 
   // set the default values for each field
   if (empty($element['#value'])) {
-    $element['#value'] = array(
+    $element['#value'] = [
       'items' => '',
       'items_file' => '',
       'file_path' => '',
-    );
+    ];
   }
 
   $element['#tree'] = TRUE;
@@ -53,27 +53,27 @@ function expand_file_upload_combo($element, $form_state, $complete_form) {
   // add items text area element
   $parents = $element['#parents'];
   $parents[] = 'items';
-  $element['items'] = array(
+  $element['items'] = [
     '#type' => 'textarea',
     '#default_value' => (isset($element['#value']['items'])) ? $element['#value']['items'] : '',
-  );
+  ];
 
   // add file upload element
   $parents = $element['#parents'];
   $parents[] = 'items_file';
-  $element['items_file'] = array(
+  $element['items_file'] = [
     '#type' => 'file',
-    '#title' =>  'File upload',
+    '#title' => 'File upload',
     '#default_value' => (isset($element['#value']['items_file'])) ? $element['#value']['items_file'] : '',
-  );
+  ];
 
   // add hidden elelment
   $parents = $element['#parents'];
   $parents[] = 'file_path';
-  $element['file_path'] = array(
+  $element['file_path'] = [
     '#type' => 'hidden',
     '#default_value' => (isset($element['#value']['file_path'])) ? $element['#value']['file_path'] : '',
-  );
+  ];
 
   return $element;
 }
@@ -102,7 +102,7 @@ function theme_file_upload_combo($variables) {
  * @ingroup tripal_legacy_core
  */
 function file_upload_combo_value_callback($element, $input = FALSE, &$form_state) {
-  $values = array();
+  $values = [];
 
   if ($input == FALSE) {
     if (!empty($element['#default_value'])) {
@@ -114,10 +114,10 @@ function file_upload_combo_value_callback($element, $input = FALSE, &$form_state
   }
 
   // get the items in the textbox
-  $items =  $input['items'];
+  $items = $input['items'];
   if ($items) {
     // split on new line or comma
-    $vals  = preg_split("/[\n,]+/", $items);
+    $vals = preg_split("/[\n,]+/", $items);
     // iterate through the values and trim surrounding space
     foreach ($vals as $i => $value) {
       $values[] = trim($value);
@@ -125,7 +125,7 @@ function file_upload_combo_value_callback($element, $input = FALSE, &$form_state
   }
 
   // merge any items from the file upload
-  $file = file_save_upload($element['#name'], array());
+  $file = file_save_upload($element['#name'], []);
   if ($file) {
     $file_path = $file->uri;
 
@@ -139,7 +139,7 @@ function file_upload_combo_value_callback($element, $input = FALSE, &$form_state
       $items = trim($line);
 
       // split on new line or comma
-      $vals  = preg_split("/[\n,]+/", $items);
+      $vals = preg_split("/[\n,]+/", $items);
       // iterate through the values and trim surrounding space
       foreach ($vals as $i => $value) {
         $values[] = trim($value);
@@ -163,10 +163,10 @@ function expand_sequence_combo($element, $form_state, $complete_form) {
 
   // set the default values for each field
   if (empty($element['#value'])) {
-    $element['#value'] = array(
+    $element['#value'] = [
       'upstream' => '',
       'downstream' => '',
-    );
+    ];
   }
 
   $element['#tree'] = TRUE;
@@ -174,22 +174,22 @@ function expand_sequence_combo($element, $form_state, $complete_form) {
   // add the upstream box
   $parents = $element['#parents'];
   $parents[] = 'upstream';
-  $element['upstream'] = array(
-     '#type' => 'textfield',
-     '#title' => t('Get Upstream Bases'),
-     '#description' => t('Specify the number of upstream bases to include in the sequence'),
-     '#default_value' => $element['#value']['upstream'],
-  );
+  $element['upstream'] = [
+    '#type' => 'textfield',
+    '#title' => t('Get Upstream Bases'),
+    '#description' => t('Specify the number of upstream bases to include in the sequence'),
+    '#default_value' => $element['#value']['upstream'],
+  ];
   // add the downstream box
   $parents = $element['#parents'];
   $parents[] = 'downstream';
-  $element['downstream'] = array(
-     '#type' => 'textfield',
-     '#prefix' => '<br>',
-     '#title' => t('Get Downstream Bases'),
-     '#description' => t('Specify the number of downstream bases to include in the sequence'),
-     '#default_value' => $element['#value']['downstream'],
-  );
+  $element['downstream'] = [
+    '#type' => 'textfield',
+    '#prefix' => '<br>',
+    '#title' => t('Get Downstream Bases'),
+    '#description' => t('Specify the number of downstream bases to include in the sequence'),
+    '#default_value' => $element['#value']['downstream'],
+  ];
   return $element;
 }
 

+ 87 - 71
legacy/tripal_core/includes/tripal_core.search.inc

@@ -9,26 +9,27 @@
 /**
  * Implements hook_search_include_chado_fields().
  *
- * This hook allows Tripal Admin/modules to specify which chado fields should be indexed
- * for searching in a simple manner.
+ * This hook allows Tripal Admin/modules to specify which chado fields should
+ * be indexed for searching in a simple manner.
  *
  * @return
- *   An array of chado fields you would like available for indexing. Each element should
- *   be the name of the table followed by the field and separated by a period. For example.
- *   feature.uniquename to indicate the uniquename field from the feature table.
+ *   An array of chado fields you would like available for indexing. Each
+ *   element should be the name of the table followed by the field and
+ *   separated by a period. For example. feature.uniquename to indicate the
+ *   uniquename field from the feature table.
  */
 function tripal_core_search_include_chado_fields() {
-  return array(
+  return [
     'organism.genus',
     'organism.species',
-  );
+  ];
 }
 
 /**
  * Implements hook_entity_property_info_alter().
  *
- * This is where we actually add the properties to the node entity in order to indicate
- * which chado fields should be indexed.
+ * This is where we actually add the properties to the node entity in order to
+ * indicate which chado fields should be indexed.
  */
 function tripal_core_entity_property_info_alter(&$info) {
 
@@ -60,21 +61,21 @@ function tripal_core_entity_property_info_alter(&$info) {
         $machine_name = $n['chado_node_api']['base_table'] . '.' . $field_name;
 
         // Try to create a readable label.
-        $label = ucwords(str_replace(array('.','_'),' ',$machine_name));
+        $label = ucwords(str_replace(['.', '_'], ' ', $machine_name));
 
         // We want to add all name fields and any fields previously indicated to be indexed.
         if (preg_match('/name/', $field_name) OR in_array($machine_name, $fields_to_include)) {
 
-          if (!isset($info['node']['bundles'][ $n['base'] ]['properties'][$machine_name])) {
-            $info['node']['bundles'][ $n['base'] ]['properties'][$machine_name] = array(
+          if (!isset($info['node']['bundles'][$n['base']]['properties'][$machine_name])) {
+            $info['node']['bundles'][$n['base']]['properties'][$machine_name] = [
               'label' => $label,
               'description' => (isset($details['description'])) ? $details['description'] : '',
               'type' => ($details['type'] == 'varchar') ? 'text' : $details['type'],
               'schema field' => '[' . $machine_name . ']',
               // The following getter callback is a generic function that can retrieve
               // values for any chado field.
-              'getter callback' => 'tripal_search_chado_token_getter_callback'
-            );
+              'getter callback' => 'tripal_search_chado_token_getter_callback',
+            ];
           }
         }
       }
@@ -90,7 +91,7 @@ function tripal_core_entity_property_info_alter(&$info) {
 
           // Try to create a readable label.
           $label = $table . ' (' . $machine_name . ')';
-          if (preg_match('/(\w+)_id/',$left_field,$matches)) {
+          if (preg_match('/(\w+)_id/', $left_field, $matches)) {
             // Key only field.
             $key_label = ucwords(str_replace('_', ' ', $matches[1]));
 
@@ -106,7 +107,7 @@ function tripal_core_entity_property_info_alter(&$info) {
           // First, create the key version. This is best used for facets since it
           // won't/can't be tokenized along with the other fields. This will be shared
           // among node types to facillitate use as a facet.
-          $info['node']['properties'][$table . '.' . $right_field .' key'] = array(
+          $info['node']['properties'][$table . '.' . $right_field . ' key'] = [
             'label' => $key_label . ' (All Content Types)',
             'description' => (isset($field_details['description'])) ? $field_details['description'] : '',
             'type' => 'text',
@@ -116,23 +117,23 @@ function tripal_core_entity_property_info_alter(&$info) {
             'schema field' => $format,
             // The following getter callback is a generic function that can retrieve
             // values for any chado foreign key.
-            'getter callback' => 'tripal_search_chado_token_across_nodetypes_getter_callback'
-          );
+            'getter callback' => 'tripal_search_chado_token_across_nodetypes_getter_callback',
+          ];
 
           $pretoken = '[' . $n['chado_node_api']['base_table'] . '.' . $left_field . '>' . $table . '.' . $right_field . ']';
           $format = chado_node_get_readable_format($pretoken);
 
           // Add a more readable version that will be tokenized so users can
           // search for fruitfly and get all features with that as an organism.
-          $info['node']['bundles'][ $n['base'] ]['properties'][$machine_name .' expanded'] = array(
+          $info['node']['bundles'][$n['base']]['properties'][$machine_name . ' expanded'] = [
             'label' => $label . ' (Expanded)',
             'description' => (isset($field_details['description'])) ? $field_details['description'] : '',
             'type' => 'text',
             'schema field' => $format,
             // The following getter callback is a generic function that can retrieve
             // values for any chado foreign key.
-            'getter callback' => 'tripal_search_chado_token_getter_callback'
-          );
+            'getter callback' => 'tripal_search_chado_token_getter_callback',
+          ];
         }
       }
     }
@@ -143,32 +144,40 @@ function tripal_core_entity_property_info_alter(&$info) {
 }
 
 /**
- * Allows tripal admin to alter entity property information after it has. This is currently
- * being used to indicate chado fields to be indexed for search.
+ * Allows tripal admin to alter entity property information after it has. This
+ * is currently being used to indicate chado fields to be indexed for search.
  *
- * NOTE: If you simply need to add a field to be indexed, use hook_search_include_chado_fields()
- * which provides the much easier method of simply listing fields to include.
+ * NOTE: If you simply need to add a field to be indexed, use
+ * hook_search_include_chado_fields() which provides the much easier method of
+ * simply listing fields to include.
  *
- * This function is most useful if you want to change the way the value is retrieved
- * (done by changing the 'getter callback') or add your own custom computed field.
+ * This function is most useful if you want to change the way the value is
+ * retrieved
+ * (done by changing the 'getter callback') or add your own custom computed
+ * field.
  */
-function hook_tripal_search_properties_alter(&$info) { }
+function hook_tripal_search_properties_alter(&$info) {
+}
 
 /**
  * Implements a getter callback for chado token formats.
  *
  * A chado token format is a string containing chado tokens.
  *
- * Chado tokens are expected to follow the format of tokens auto-generated using
- *   chado_node_generate_tokens(). For example, [feature.uniquename] indicates you
- *   should return the uniquename of a feature node and [feature.organism_id>organism.species]
- *   indicates you should return the organism genus of the feature node.
+ * Chado tokens are expected to follow the format of tokens auto-generated
+ * using
+ *   chado_node_generate_tokens(). For example, [feature.uniquename] indicates
+ * you should return the uniquename of a feature node and
+ * [feature.organism_id>organism.species] indicates you should return the
+ * organism genus of the feature node.
  *
- * The chado token format must be stored in the 'schema field' when defining the property in
- *  hook_entity_property_info() in order for this getter to work.
+ * The chado token format must be stored in the 'schema field' when defining
+ * the property in hook_entity_property_info() in order for this getter to
+ * work.
  *
  * @param $data
- *   The entity object (in our case the node we need to retrieve feature properties for).
+ *   The entity object (in our case the node we need to retrieve feature
+ *   properties for).
  * @param $options
  * @param $field_name
  *   The machine name for the entity property.
@@ -185,14 +194,16 @@ function tripal_search_chado_token_getter_callback($data, $options, $field_name,
       $format = $info['schema field'];
 
       // Determine our base table so we know if this is even the right node type.
-      if (preg_match('/\[(\w+)\.(\w+)/',$format, $matches)) {
+      if (preg_match('/\[(\w+)\.(\w+)/', $format, $matches)) {
         $base_table = $matches[1];
         $field_name = $matches[2];
 
         // For some weird reason nodes of all types are trying to get a value for fields
         // that we defined as specific to a given node type (ie: bundle). As such we need
         // this check here to ensure this field is actually for this node type.
-        if (!isset($data->{$base_table})) return NULL;
+        if (!isset($data->{$base_table})) {
+          return NULL;
+        }
 
         $format = tripal_core_get_token_value_for_property($base_table, $field_name, $format, $data, $info);
         return $format;
@@ -203,7 +214,7 @@ function tripal_search_chado_token_getter_callback($data, $options, $field_name,
           'tripal_search',
           TRIPAL_ERROR,
           'Unable to extract the base table from the format (:format) for :field because it didn\'t match the expected format: [tablename.field...',
-          array(':field' => $field_name, ':format' => $format)
+          [':field' => $field_name, ':format' => $format]
         );
         return NULL;
       }
@@ -213,7 +224,7 @@ function tripal_search_chado_token_getter_callback($data, $options, $field_name,
         'tripal_search',
         TRIPAL_ERROR,
         'Unable to get value for :field because the schema field was not set.',
-        array(':field' => $field_name)
+        [':field' => $field_name]
       );
       return NULL;
     }
@@ -224,7 +235,8 @@ function tripal_search_chado_token_getter_callback($data, $options, $field_name,
  * Implements a getter callback for foreign keys collon between content types.
  *
  * @param $data
- *   The entity object (in our case the node we need to retrieve feature properties for).
+ *   The entity object (in our case the node we need to retrieve feature
+ *   properties for).
  * @param $options
  * @param $field_name
  *   The machine name for the entity property.
@@ -239,7 +251,7 @@ function tripal_search_chado_token_across_nodetypes_getter_callback($data, $opti
   // First, make sure this is a chado node.
   // Assumption #1: All chado node types are prefixed with chado_
   if (isset($data->nid)) {
-    if (preg_match('/^chado_(\w+)/',$data->type,$matches)) {
+    if (preg_match('/^chado_(\w+)/', $data->type, $matches)) {
       if (isset($info['schema field'])) {
 
         // Assumption #2: The base table is the suffix of the node type.
@@ -258,7 +270,7 @@ function tripal_search_chado_token_across_nodetypes_getter_callback($data, $opti
           'tripal_search',
           TRIPAL_ERROR,
           'Unable to extract the base table from the format (:format) for :field because it didn\'t match the expected format: [tablename.field...',
-          array(':field' => $field_name, ':format' => $format)
+          [':field' => $field_name, ':format' => $format]
         );
       }
     }
@@ -267,7 +279,7 @@ function tripal_search_chado_token_across_nodetypes_getter_callback($data, $opti
         'tripal_search',
         TRIPAL_ERROR,
         'Unable to get value for :field because the schema field was not set.',
-        array(':field' => $field_name)
+        [':field' => $field_name]
       );
     }
   }
@@ -290,25 +302,27 @@ function tripal_core_get_token_value_for_property($base_table, $field_name, $for
         'tripal_search',
         TRIPAL_NOTICE,
         'Returned static text for :field since there were no tokens in the supplied format: :format',
-        array(':field' => $field_name, ':format' => $format)
+        [':field' => $field_name, ':format' => $format]
       );
       return $format;
     }
 
     // Get the value of each token.
-    $null_tokens = array();
+    $null_tokens = [];
     foreach ($used_tokens as $token) {
-      $token_info = array(
-          'name' => $info['label'],
-          'table' => $base_table,
-          'field' => $field_name,
-          'token' => $token,
-          'description' => $info['description'],
-          'location' => chado_node_get_location_from_token($token),
-      );
-
-      $value = chado_get_token_value($token_info, $data, array('supress_errors' => TRUE));
-      if (empty($value)) $null_tokens[] = $token;
+      $token_info = [
+        'name' => $info['label'],
+        'table' => $base_table,
+        'field' => $field_name,
+        'token' => $token,
+        'description' => $info['description'],
+        'location' => chado_node_get_location_from_token($token),
+      ];
+
+      $value = chado_get_token_value($token_info, $data, ['supress_errors' => TRUE]);
+      if (empty($value)) {
+        $null_tokens[] = $token;
+      }
 
       // And sub it in to the format.
       $format = str_replace($token, $value, $format);
@@ -316,14 +330,16 @@ function tripal_core_get_token_value_for_property($base_table, $field_name, $for
 
     // If none of the tokens had values then this node doesn't have this field.
     // As such we return null so the search api doesn't bother indexing an empty format.
-    if (sizeof($used_tokens) == sizeof($null_tokens)) return NULL;
+    if (sizeof($used_tokens) == sizeof($null_tokens)) {
+      return NULL;
+    }
   }
   else {
     tripal_report_error(
       'tripal_search',
       TRIPAL_NOTICE,
       'Returned static text for :field since there were no tokens of a recognized format in the supplied format: :format',
-      array(':field' => $field_name, ':format' => $format)
+      [':field' => $field_name, ':format' => $format]
     );
   }
 
@@ -334,12 +350,12 @@ function tripal_core_get_token_value_for_property($base_table, $field_name, $for
  * Implements hook_modules_enabled().
  *
  * This hook is called when ANY module is enabled. This allows us to update the
- * the search api "Default node index" when any Tripal module is enabled thus allowing us
- * to catch new node types right after they're created.
+ * the search api "Default node index" when any Tripal module is enabled thus
+ * allowing us to catch new node types right after they're created.
  */
 function tripal_core_modules_enabled($modules) {
   if (module_exists('search_api')) {
-    $index_enabled = db_query('SELECT enabled FROM search_api_index WHERE machine_name=:name', array(':name' => 'default_node_index'))->fetchField();
+    $index_enabled = db_query('SELECT enabled FROM search_api_index WHERE machine_name=:name', [':name' => 'default_node_index'])->fetchField();
     if ($index_enabled) {
       tripal_search_update_default_index();
     }
@@ -355,14 +371,14 @@ function tripal_core_modules_enabled($modules) {
  * This function should be called whenever new nodes might have been
  * added to ensure that their fields are added as well.
  *
- * We should only modify the default node index if it has no database service yet.
- * That way we ensure we don't override user changes!
+ * We should only modify the default node index if it has no database service
+ * yet. That way we ensure we don't override user changes!
  */
 function tripal_search_update_default_index() {
 
   // First we need the index object for the "Default node index".
   $index_id = db_query('SELECT id FROM search_api_index WHERE machine_name=:name',
-    array(':name' => 'default_node_index'))->fetchField();
+    [':name' => 'default_node_index'])->fetchField();
   if (!$index_id) {
     // ERROR
     return FALSE;
@@ -370,7 +386,7 @@ function tripal_search_update_default_index() {
   $index = search_api_index_load($index_id);
 
   // Collect all the fields already added to the search index.
-  $changes = array('options' => $index->options);
+  $changes = ['options' => $index->options];
 
   // Now we only want to update the index if it's both enabled and has no server indicated.
   // That way we can be reasonably sure that it was been untouched by admin users.
@@ -394,7 +410,7 @@ function tripal_search_update_default_index() {
 
             // Furthermore if this is a name then we want to add a boost to ensure it carries
             // more weight in the search results.
-            if (preg_match('/name/',$field_name)) {
+            if (preg_match('/name/', $field_name)) {
               $changes['options']['fields'][$field_name]['boost'] = '3.0';
             }
           }
@@ -406,18 +422,18 @@ function tripal_search_update_default_index() {
     // We also want to enable highlighting to ensure an excerpt is generated since this
     // will be used in the default search view distributed with Tripal.
     if (!isset($index->options['processors']['search_api_highlighting'])) {
-      $changes['options']['processors']['search_api_highlighting'] = array(
+      $changes['options']['processors']['search_api_highlighting'] = [
         'status' => 1,
         'weight' => 35,
-        'settings' => array(
+        'settings' => [
           'prefix' => '<strong>',
           'suffix' => '</strong>',
           'excerpt' => 1,
           'excerpt_length' => 256,
-          'exclude_fields' => array(),
+          'exclude_fields' => [],
           'highlight' => 'always',
-        ),
-      );
+        ],
+      ];
     }
     else {
       $changes['options']['processors']['search_api_highlighting']['status'] = 1;

+ 103 - 104
legacy/tripal_core/includes/tripal_core.toc.inc

@@ -11,18 +11,18 @@ function tripal_core_node_toc_form($form, &$form_state, $node) {
 
   $form["#tree"] = TRUE;
 
-  $form["instructions"] = array(
+  $form["instructions"] = [
     '#type' => 'fieldset',
     '#collapsed' => TRUE,
     '#collapsible' => TRUE,
     '#title' => 'Instructions',
-  );
+  ];
   $admin_link = l(
     $type_info->name . " TOC administrative page",
     "admin/tripal/legacy/" . $type_info->module . "/" . $node->type . "toc",
-    array('attributes' => array('target' => '_blank'))
+    ['attributes' => ['target' => '_blank']]
   );
-  $form["instructions"]["main"] = array(
+  $form["instructions"]["main"] = [
     '#markup' => '<p>' . t("Below is a list of the titles of
       content panes that can appear on this page.  These titles appear in the
       the following order in the Table of Contents (TOC). You may rename
@@ -32,12 +32,12 @@ function tripal_core_node_toc_form($form, &$form_state, $node) {
       '<p>' . t('The list below shows all possible content panes that can appear.
       However, those without content are automatically hidden and do not
       appear in the TOC.' . '</p>'),
-  );
+  ];
 
-  $form['node'] = array(
+  $form['node'] = [
     '#type' => 'value',
     '#value' => $node,
-  );
+  ];
 
   // Get the content array for this node, then pass it through the
   // tripal_core_node_view_alter which generates the TOC.  After that
@@ -51,7 +51,7 @@ function tripal_core_node_toc_form($form, &$form_state, $node) {
   tripal_core_node_view_alter($build);
 
   // Iterate through the built items and add form elemetns for each one.
-  foreach(element_children($build) as $key) {
+  foreach (element_children($build) as $key) {
     $element = $build[$key];
 
     if (array_key_exists('#tripal_toc_id', $element)) {
@@ -65,102 +65,103 @@ function tripal_core_node_toc_form($form, &$form_state, $node) {
       // interface that created the link.
       $is_link = array_key_exists('#is_link', $element) ? $element['#is_link'] : FALSE;
       if (!$is_link) {
-        $form['toc_items'][$toc_id]['title'] = array(
+        $form['toc_items'][$toc_id]['title'] = [
           '#type' => 'textfield',
           '#default_value' => $toc_title,
-        );
+        ];
       }
       else {
-        $form['toc_items'][$toc_id]['title'] = array(
+        $form['toc_items'][$toc_id]['title'] = [
           '#markup' => '<i>link title:</i> ' . $toc_title,
           '#value' => $toc_title,
-        );
+        ];
       }
-      $form['toc_items'][$toc_id]['hide'] = array(
+      $form['toc_items'][$toc_id]['hide'] = [
         '#type' => 'checkbox',
         '#default_value' => $toc_hide,
-      );
-      $form['toc_items'][$toc_id]['weight'] = array(
+      ];
+      $form['toc_items'][$toc_id]['weight'] = [
         '#type' => 'textfield',
         '#default_value' => $toc_weight,
-        '#attributes' => array(
-          'class' => array('tripal-node-toc-items-weights'),
-        ),
+        '#attributes' => [
+          'class' => ['tripal-node-toc-items-weights'],
+        ],
         '#size' => 5,
-      );
+      ];
     }
   }
   $form['toc_items']['#theme'] = 'tripal_node_toc_items_table';
 
-  $form['submit'] = array(
+  $form['submit'] = [
     '#type' => 'submit',
     '#name' => 'toc_submit',
     '#value' => t('Submit'),
-  );
-  $form['unset'] = array(
+  ];
+  $form['unset'] = [
     '#type' => 'submit',
     '#name' => 'toc_unset',
     '#value' => t('Unset Node Customizations'),
-  );
+  ];
 
   // Check to see if this node's TOC is specifically being managed.
   $sql = "SELECT count(*) FROM {tripal_toc} where nid = :nid";
-  $managed_items = db_query($sql, array(':nid' => $node->nid))->fetchField();
+  $managed_items = db_query($sql, [':nid' => $node->nid])->fetchField();
 
   if ($managed_items > 0) {
-    $form['is_managed'] = array(
+    $form['is_managed'] = [
       '#markup' => '<p><font color="red">' .
-      t('This page currently has customiations to the TOC.</font> This means
+        t('This page currently has customiations to the TOC.</font> This means
         that any customzations for the content type are overriden. Click the
         "Unset Node Customizations" button above to remove page-level
         customizations and default to the content type settings.') . '</p>',
-    );
+    ];
   }
 
 
   return $form;
 }
+
 /**
  *
  * @param $variables
  */
 function theme_tripal_node_toc_items_table($variables) {
   $elements = $variables['element'];
-  $toc_items = array();
+  $toc_items = [];
 
   // Sort the toc_items using a custom sort function. But we need to include
   // only the items we want in the table (exclude renderable stuff).
-  foreach(element_children($elements) as $key) {
+  foreach (element_children($elements) as $key) {
     $toc_items[] = $elements[$key];
   }
   usort($toc_items, 'theme_tripal_node_sort_toc_items');
 
   // Build the table header.
-  $headers = array('Content Pane Name', 'Hide', 'Weight');
+  $headers = ['Content Pane Name', 'Hide', 'Weight'];
 
   // Format the form elements as rows in the table.
-  $rows = array();
+  $rows = [];
   foreach ($toc_items as $key => $item) {
-    $rows[] = array(
-      'data' => array(
+    $rows[] = [
+      'data' => [
         drupal_render($item['title']),
         drupal_render($item['hide']),
         drupal_render($item['weight']),
-      ),
-      'class' => array('draggable'),
-    );
+      ],
+      'class' => ['draggable'],
+    ];
   }
 
   // Theme and return the table.
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array("id" => 'tripal-node-toc-items-table'),
+    'attributes' => ["id" => 'tripal-node-toc-items-table'],
     'sticky' => TRUE,
     'caption' => t('Content Panes Available in the TOC'),
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => t('There are no content panes for this page'),
-  );
+  ];
   drupal_add_tabledrag('tripal-node-toc-items-table', 'order', 'sibling', 'tripal-node-toc-items-weights');
   return theme_table($table);
 }
@@ -196,12 +197,13 @@ function tripal_core_node_toc_form_validate($form, &$form_state) {
     }
   }
 }
+
 /**
  * Implements hook_submit for the tripal_core_node_toc_form.
  */
 function tripal_core_node_toc_form_submit($form, &$form_state) {
   $toc_items = $form_state['values']['toc_items'];
-  $node      = $form_state['values']['node'];
+  $node = $form_state['values']['node'];
 
   if ($form_state['clicked_button']['#name'] == "toc_submit") {
     $transaction = db_transaction();
@@ -214,19 +216,18 @@ function tripal_core_node_toc_form_submit($form, &$form_state) {
       // Second add in any new settings for this node
       foreach ($toc_items as $toc_id => $item) {
         db_insert('tripal_toc')
-          ->fields(array(
+          ->fields([
             'node_type' => $node->type,
             'key' => $toc_id,
             'title' => array_key_exists('title', $item) ? $item['title'] : '',
             'weight' => $item['weight'],
             'nid' => $node->nid,
             'hide' => $item['hide'],
-          ))
+          ])
           ->execute();
       }
       drupal_set_message("TOC changes successfully applied to this node only.");
-    }
-    catch (Exception $e) {
+    } catch (Exception $e) {
       $transaction->rollback();
       drupal_set_message("Failed to apply TOC changes.", "error");
     }
@@ -240,8 +241,7 @@ function tripal_core_node_toc_form_submit($form, &$form_state) {
         ->execute();
 
       drupal_set_message("TOC is no longer customized specifically for this page. Now using the content type settings.");
-    }
-    catch (Exception $e) {
+    } catch (Exception $e) {
       $transaction->rollback();
       drupal_set_message("Failed to apply TOC changes.", "error");
     }
@@ -281,7 +281,7 @@ function tripal_core_node_view_build_toc(&$build) {
 
   $cache = cache_get("theme_registry:$theme", 'cache');
   $node = $build['#node'];
-  $toc = array();
+  $toc = [];
   $toc_html = '';
 
   // If we are looking at a Tripal node template then we want to
@@ -291,7 +291,7 @@ function tripal_core_node_view_build_toc(&$build) {
 
     // Iterate through all the elements of the $build array and for those
     // that are wanting to provide content for this node.
-    $markup = array();
+    $markup = [];
     foreach ($build as $key => $value) {
       $value = $build[$key];
 
@@ -358,7 +358,7 @@ function tripal_core_node_view_build_toc(&$build) {
           // Add the link to the TOC
           $parts = explode("|", $element['#markup']);
           if (count($parts) == 2) {
-            $toc[$weight][$parts[0]] = "<div id=\"$toc_item_id\" class=\"tripal_toc_list_item\">" . l($parts[0], $parts[1], array('attributes' => array('target' => '_blank'))) . "</div>";
+            $toc[$weight][$parts[0]] = "<div id=\"$toc_item_id\" class=\"tripal_toc_list_item\">" . l($parts[0], $parts[1], ['attributes' => ['target' => '_blank']]) . "</div>";
           }
           else {
             $toc[$weight][$parts[0]] = "<div id=\"$toc_item_id\" class=\"tripal_toc_list_item\">" . $element['#markup'] . "</div>";
@@ -446,8 +446,8 @@ function tripal_core_node_view_build_toc(&$build) {
       // INITIALIZE THE CONTENT VARIABLES
       //-----------------------
       $toc_item_title = $key;
-      $toc_item_id    = $key;
-      $toc_item_link  = '';
+      $toc_item_id = $key;
+      $toc_item_link = '';
       $weight = 0;
       $hide = 0;
 
@@ -508,16 +508,16 @@ function tripal_core_node_view_build_toc(&$build) {
       }
 
       // Setup the content array for this element
-      $build[$key] = array(
+      $build[$key] = [
         '#markup' => $markup,
         '#tripal_toc_id' => $toc_item_id,
         '#tripal_toc_title' => $toc_item_title,
         '#weight' => $weight,
         '#hide' => $hide,
-      );
+      ];
 
 
-        // if we still don't have markup then skip this one
+      // if we still don't have markup then skip this one
       if (!$markup) {
         continue;
       }
@@ -537,10 +537,10 @@ function tripal_core_node_view_build_toc(&$build) {
             customize the way the content above is presented.  Tripal provides a template
             file for each pane 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'))) . ".
+            l('clear the Drupal cache', 'admin/config/development/performance', ['attributes' => ['target' => '_blank']]) . ".
             Currently, the content above is provided by this template: <br><br>$path",
             TRIPAL_INFO,
-            array('return_html' => 1)
+            ['return_html' => 1]
           );
         }
       }
@@ -602,7 +602,7 @@ function tripal_core_get_toc_overrides($nid, $key, $node_type, $mode) {
   if ($mode != "manage_type") {
     // First look to see if the node has customizations for this item.
     $toc_item_overrides = db_select('tripal_toc', 'tc')
-      ->fields('tc', array('title', 'weight', 'hide'))
+      ->fields('tc', ['title', 'weight', 'hide'])
       ->condition('key', $key)
       ->condition('nid', $nid)
       ->execute()
@@ -611,18 +611,18 @@ function tripal_core_get_toc_overrides($nid, $key, $node_type, $mode) {
       $override_title = $toc_item_overrides->title;
       $override_weight = $toc_item_overrides->weight;
       $override_hide = $toc_item_overrides->hide;
-      return array(
-        'title'  => $override_title,
+      return [
+        'title' => $override_title,
         'weight' => $override_weight,
-        'hide'   => $override_hide,
-      );
+        'hide' => $override_hide,
+      ];
     }
   }
 
   // If there are no specific node customizations then look to see if there
   // are customizations for this content type.
   $toc_item_overrides = db_select('tripal_toc', 'tc')
-    ->fields('tc', array('title', 'weight', 'hide'))
+    ->fields('tc', ['title', 'weight', 'hide'])
     ->condition('node_type', $node_type)
     ->condition('key', $key)
     ->isNull('nid')
@@ -634,11 +634,11 @@ function tripal_core_get_toc_overrides($nid, $key, $node_type, $mode) {
     $override_hide = $toc_item_overrides->hide;
   }
 
-  return array(
+  return [
     'title' => $override_title,
     'weight' => $override_weight,
     'hide' => $override_hide,
-  );
+  ];
 
 }
 
@@ -656,13 +656,13 @@ function tripal_core_content_type_toc_form($form, &$form_state, $content_type) {
   // Get a single node of this type so we can get all the possible content
   // for it.
   $sql = "SELECT nid FROM {node} WHERE type = :type LIMIT 1 OFFSET 0";
-  $nid = db_query($sql, array(':type' => $content_type))->fetchField();
+  $nid = db_query($sql, [':type' => $content_type])->fetchField();
   if (!$nid) {
-    $form["not_available"] = array(
+    $form["not_available"] = [
       '#markup' => t('Please sync at least one %type_name record. A node
           must exist before customizations to the Table of Contents (TOC) can
-          be performed.', array('%type_name' => $type_info->name)),
-    );
+          be performed.', ['%type_name' => $type_info->name]),
+    ];
     return $form;
   }
 
@@ -681,32 +681,32 @@ function tripal_core_content_type_toc_form($form, &$form_state, $content_type) {
   $build["#node"] = $node;
   tripal_core_node_view_alter($build);
 
-  $form["instructions"] = array(
+  $form["instructions"] = [
     '#type' => 'fieldset',
     '#collapsed' => TRUE,
     '#collapsible' => TRUE,
     '#title' => 'Instructions',
-  );
-  $form["instructions"]["main"] = array(
+  ];
+  $form["instructions"]["main"] = [
     '#markup' => '</p>' . t('Below is a list of the titles of
       content panes that can appear on all %type_name pages.  You may rename
       the titles or drag and drop them to change the order.  Content that appears
       only on a single page can not be ordered here, but must be ordered using
       the TOC tab on the page itself.  If a page has customized TOC settings
       then those settings will take precedent over these.',
-        array('%type_name' => $type_info->name)) . '</p>' .
-    '<p>' . t('The list below shows all possible content
+        ['%type_name' => $type_info->name]) . '</p>' .
+      '<p>' . t('The list below shows all possible content
       panes that can appear. However, those without content are automatically
       hidden and do not appear in the TOC.' . '</p>'),
-  );
+  ];
 
-  $form['content_type'] = array(
+  $form['content_type'] = [
     '#type' => 'value',
     '#value' => $content_type,
-  );
+  ];
 
   // Iterate through the built items and add form elemetns for each one.
-  foreach(element_children($build) as $key) {
+  foreach (element_children($build) as $key) {
     $element = $build[$key];
 
     if (array_key_exists('#tripal_toc_id', $element)) {
@@ -714,36 +714,36 @@ function tripal_core_content_type_toc_form($form, &$form_state, $content_type) {
       $toc_title = $element['#tripal_toc_title'];
       $toc_weight = $element['#weight'];
       $toc_hide = $element['#hide'];
-      $form['toc_items'][$toc_id]['title'] = array(
+      $form['toc_items'][$toc_id]['title'] = [
         '#type' => 'textfield',
         '#default_value' => $toc_title,
-      );
-      $form['toc_items'][$toc_id]['hide'] = array(
+      ];
+      $form['toc_items'][$toc_id]['hide'] = [
         '#type' => 'checkbox',
         '#default_value' => $toc_hide,
-      );
-      $form['toc_items'][$toc_id]['weight'] = array(
+      ];
+      $form['toc_items'][$toc_id]['weight'] = [
         '#type' => 'textfield',
         '#default_value' => $toc_weight,
-        '#attributes' => array(
-          'class' => array('tripal-node-toc-items-weights'),
-        ),
+        '#attributes' => [
+          'class' => ['tripal-node-toc-items-weights'],
+        ],
         '#size' => 5,
-      );
+      ];
     }
   }
   $form['toc_items']['#theme'] = 'tripal_node_toc_items_table';
 
-  $form['submit'] = array(
+  $form['submit'] = [
     '#type' => 'submit',
     '#name' => 'toc_submit',
     '#value' => t('Submit'),
-  );
-  $form['unset'] = array(
+  ];
+  $form['unset'] = [
     '#type' => 'submit',
     '#name' => 'toc_unset',
     '#value' => t('Reset to Defaults'),
-  );
+  ];
 
   return $form;
 }
@@ -762,11 +762,12 @@ function tripal_core_content_type_toc_form_validate($form, &$form_state) {
     }
   }
 }
+
 /**
  * Implements hook_submit for the tripal_core_node_toc_form.
  */
 function tripal_core_content_type_toc_form_submit($form, &$form_state) {
-  $toc_items    = $form_state['values']['toc_items'];
+  $toc_items = $form_state['values']['toc_items'];
   $content_type = $form_state['values']['content_type'];
 
   if ($form_state['clicked_button']['#name'] == "toc_submit") {
@@ -781,18 +782,17 @@ function tripal_core_content_type_toc_form_submit($form, &$form_state) {
       // Second add in any new settings for this node
       foreach ($toc_items as $toc_id => $item) {
         db_insert('tripal_toc')
-        ->fields(array(
-          'node_type' => $content_type,
-          'key' => $toc_id,
-          'title' => $item['title'],
-          'weight' => $item['weight'],
-          'hide' => $item['hide'],
-        ))
-        ->execute();
+          ->fields([
+            'node_type' => $content_type,
+            'key' => $toc_id,
+            'title' => $item['title'],
+            'weight' => $item['weight'],
+            'hide' => $item['hide'],
+          ])
+          ->execute();
       }
       drupal_set_message("TOC changes successfully applied to this content type.");
-    }
-    catch (Exception $e) {
+    } catch (Exception $e) {
       $transaction->rollback();
       drupal_set_message("Failed to apply TOC changes.", "error");
     }
@@ -807,8 +807,7 @@ function tripal_core_content_type_toc_form_submit($form, &$form_state) {
         ->execute();
 
       drupal_set_message("The TOC is reset to defaults for this content type.");
-    }
-    catch (Exception $e) {
+    } catch (Exception $e) {
       $transaction->rollback();
       drupal_set_message("Failed to apply TOC changes.", "error");
     }

+ 64 - 60
legacy/tripal_core/theme/templates/node--chado-generic.tpl.php

@@ -5,75 +5,79 @@ if ($teaser) {
 else {
   $node_type = $node->type; ?>
 
-  <script type="text/javascript">
-    // We do not use Drupal Behaviors because we do not want this
-    // code to be executed on AJAX callbacks. This code only needs to
-    // be executed once the page is ready.
-    jQuery(document).ready(function($){
+    <script type="text/javascript">
+        // We do not use Drupal Behaviors because we do not want this
+        // code to be executed on AJAX callbacks. This code only needs to
+        // be executed once the page is ready.
+        jQuery(document).ready(function ($) {
 
-      // Hide all but the first data pane
-      $(".tripal-data-pane").hide().filter(":first-child").show();
+            // Hide all but the first data pane
+            $(".tripal-data-pane").hide().filter(":first-child").show();
 
-      // When a title in the table of contents is clicked, then
-      // show the corresponding item in the details box
-      $(".tripal_toc_list_item_link").click(function(){
-        var id = $(this).attr('id') + "-tripal-data-pane";
-        $(".tripal-data-pane").hide().filter("#"+ id).fadeIn('fast');
-        return false;
-      });
+            // When a title in the table of contents is clicked, then
+            // show the corresponding item in the details box
+            $(".tripal_toc_list_item_link").click(function () {
+                var id = $(this).attr('id') + "-tripal-data-pane";
+                $(".tripal-data-pane").hide().filter("#" + id).fadeIn('fast');
+                return false;
+            });
 
-      // If a ?pane= is specified in the URL then we want to show the
-      // requested content pane. For previous version of Tripal,
-      // ?block=, was used.  We support it here for backwards
-      // compatibility
-      var pane;
-      pane = window.location.href.match(/[\?|\&]pane=(.+?)[\&|\#]/)
-      if (pane == null) {
-        pane = window.location.href.match(/[\?|\&]pane=(.+)/)
-      }
-      // if we don't have a pane then try the old style ?block=
-      if (pane == null) {
-        pane = window.location.href.match(/[\?|\&]block=(.+?)[\&|\#]/)
-        if (pane == null) {
-          pane = window.location.href.match(/[\?|\&]block=(.+)/)
-        }
-      }
-      if(pane != null){
-        $(".tripal-data-pane").hide().filter("#" + pane[1] + "-tripal-data-pane").show();
-      }
-      // Remove the 'active' class from the links section, as it doesn't
-      // make sense for this layout
-      $("a.active").removeClass('active');
-    });
-  </script>
+            // If a ?pane= is specified in the URL then we want to show the
+            // requested content pane. For previous version of Tripal,
+            // ?block=, was used.  We support it here for backwards
+            // compatibility
+            var pane;
+            pane = window.location.href.match(/[\?|\&]pane=(.+?)[\&|\#]/)
+            if (pane == null) {
+                pane = window.location.href.match(/[\?|\&]pane=(.+)/)
+            }
+            // if we don't have a pane then try the old style ?block=
+            if (pane == null) {
+                pane = window.location.href.match(/[\?|\&]block=(.+?)[\&|\#]/)
+                if (pane == null) {
+                    pane = window.location.href.match(/[\?|\&]block=(.+)/)
+                }
+            }
+            if (pane != null) {
+                $(".tripal-data-pane").hide().filter("#" + pane[1] + "-tripal-data-pane").show();
+            }
+            // Remove the 'active' class from the links section, as it doesn't
+            // make sense for this layout
+            $("a.active").removeClass('active');
+        });
+    </script>
 
-  <div id="tripal_<?php print $node_type?>_contents" class="tripal-contents">
-    <table id ="tripal-<?php print $node_type?>-contents-table" class="tripal-contents-table">
-      <tr class="tripal-contents-table-tr">
-        <td nowrap class="tripal-contents-table-td tripal-contents-table-td-toc"  align="left"><?php
+    <div id="tripal_<?php print $node_type ?>_contents" class="tripal-contents">
+        <table id="tripal-<?php print $node_type ?>-contents-table"
+               class="tripal-contents-table">
+            <tr class="tripal-contents-table-tr">
+                <td nowrap
+                    class="tripal-contents-table-td tripal-contents-table-td-toc"
+                    align="left"><?php
 
-          // print the table of contents. It's found in the content array
-          if (array_key_exists('tripal_toc', $content)) {
-            print $content['tripal_toc']['#markup'];
+                  // print the table of contents. It's found in the content array
+                  if (array_key_exists('tripal_toc', $content)) {
+                    print $content['tripal_toc']['#markup'];
 
-            // we may want to add the links portion of the contents to the sidebar
-            //print render($content['links']);
+                    // we may want to add the links portion of the contents to the sidebar
+                    //print render($content['links']);
 
-            // remove the table of contents and links so thye doent show up in the
-            // data section when the rest of the $content array is rendered
-            unset($content['tripal_toc']);
-            unset($content['links']);
-          } ?>
+                    // remove the table of contents and links so thye doent show up in the
+                    // data section when the rest of the $content array is rendered
+                    unset($content['tripal_toc']);
+                    unset($content['links']);
+                  } ?>
 
-        </td>
-        <td class="tripal-contents-table-td-data" align="left" width="100%"> <?php
+                </td>
+                <td class="tripal-contents-table-td-data" align="left"
+                    width="100%"> <?php
 
-          // print the rendered content
-          print render($content); ?>
-        </td>
-      </tr>
-    </table>
-  </div> <?php
+                  // print the rendered content
+                  print render($content); ?>
+                </td>
+            </tr>
+        </table>
+    </div> <?php
 }
 
 

+ 5 - 3
legacy/tripal_core/theme/templates/tripal_core_jobs_help.tpl.php

@@ -1,3 +1,5 @@
-<p>The Tripal Jobs Management System provides a framework for Biological jobs to be run
-via the command-line in order to eliminate the problems associated with long running
-jobs in the web browser (ie: timeout errors).</p>
+<p>The Tripal Jobs Management System provides a framework for Biological jobs to
+    be run
+    via the command-line in order to eliminate the problems associated with long
+    running
+    jobs in the web browser (ie: timeout errors).</p>

+ 5 - 3
legacy/tripal_core/theme/templates/tripal_core_mviews_help.tpl.php

@@ -1,3 +1,5 @@
-<p>The Tripal Jobs Management System provides a framework for Biological jobs to be run
-via the command-line in order to eliminate the problems associated with long running
-jobs in the web browser (ie: timeout errors).</p>
+<p>The Tripal Jobs Management System provides a framework for Biological jobs to
+    be run
+    via the command-line in order to eliminate the problems associated with long
+    running
+    jobs in the web browser (ie: timeout errors).</p>

+ 84 - 84
legacy/tripal_core/tripal_core.drush.inc

@@ -45,107 +45,107 @@ function tripal_core_drush_help($command) {
  * @ingroup tripal_drush
  */
 function tripal_core_drush_command() {
-  $items = array();
+  $items = [];
 
-  $items['trp-clean-nodes'] = array(
+  $items['trp-clean-nodes'] = [
     'description' => dt('Removes orphaned Drupal nodes.'),
-    'arguments' => array(),
-    'examples' => array(
-      'Standard Example' => 'drush trp-clean-nodes table=feature'
-    ),
-    'options' => array(
-      'table' => array(
+    'arguments' => [],
+    'examples' => [
+      'Standard Example' => 'drush trp-clean-nodes table=feature',
+    ],
+    'options' => [
+      'table' => [
         'description' => dt('The name of the table that corresonds to the node type to ' .
           'clean up. (e.g organism, feature, stock, library, analysis, pub, etc.)'),
         'required' => TRUE,
-      ),
-    ),
-  );
+      ],
+    ],
+  ];
 
   // DEPRECATED COMMANDS. Deprecated as of Tripal v2.0-rc
-  $items['tripal-mview-update'] = array(
+  $items['tripal-mview-update'] = [
     'description' => dt('DEPRECATED. Please see: trp-refresh-mview.'),
-    'arguments' => array(),
-    'examples' => array(
+    'arguments' => [],
+    'examples' => [
       'By Materialized View ID' => 'drush tripal-update-mview --mview_id=5',
-      'By Table Name' => 'drush tripal-update-mview --table_name=organism_feature_count'
-    ),
-    'options' => array(
+      'By Table Name' => 'drush tripal-update-mview --table_name=organism_feature_count',
+    ],
+    'options' => [
       'mview_id' => dt('The ID of the materialized view to update'),
       'table_name' => dt('The name of the materialized view table to update.'),
-    ),
-    'aliases' => array('trpmv-up')
-  );
-  $items['tripal-jobs-current'] = array(
+    ],
+    'aliases' => ['trpmv-up'],
+  ];
+  $items['tripal-jobs-current'] = [
     'description' => dt('DEPRECATED. Please see: trp-get-currjob.'),
-    'arguments'   => array(),
-    'examples' => array(
+    'arguments' => [],
+    'examples' => [
       'Standard example' => 'drush tripal-jobs-current',
-    ),
-    'aliases' => array('trpjob-cur'),
-  );
-  $items['tripal-jobs-launch'] = array(
+    ],
+    'aliases' => ['trpjob-cur'],
+  ];
+  $items['tripal-jobs-launch'] = [
     'description' => dt('DEPRECATED. Please see: trp-run-jobs. '),
-    'examples' => array(
+    'examples' => [
       'Normal Job' => 'drush tripal-jobs-launch admin',
-      'Parallel Job' => 'drush tripal-jobs-launch admin --parallel=1'
-    ),
-    'arguments' => array(
+      'Parallel Job' => 'drush tripal-jobs-launch admin --parallel=1',
+    ],
+    'arguments' => [
       'username' => dt('The Drupal username under which the job should be run.  The permissions for this user will be used.'),
-    ),
-    'options' => array(
+    ],
+    'options' => [
       'parallel' => dt('Normally jobs are executed one at a time. But if you are certain no conflicts will occur with other currently running jobs you may set this argument to a value of 1 to make the job run in parallel with other running jobs.'),
       'job_id' => dt('Provide a job_id to run a specific job. Only jobs that have not been run already can be used'),
-    ),
-    'aliases' => array('trpjob-run')
-  );
-  $items['tripal-jobs-rerun'] = array(
+    ],
+    'aliases' => ['trpjob-run'],
+  ];
+  $items['tripal-jobs-rerun'] = [
     'description' => dt('DEPRECATED. Please see: trp-rerun-job. '),
-    'examples' => array(
+    'examples' => [
       'Normal Job' => 'drush tripal-jobs-rerun admin 2',
-      'Parallel Job' => 'drush tripal-jobs-rerun admin  2 --parallel=1'
-    ),
-    'arguments' => array(
+      'Parallel Job' => 'drush tripal-jobs-rerun admin  2 --parallel=1',
+    ],
+    'arguments' => [
       'username' => dt('The Drupal username under which the job should be run.  The permissions for this user will be used.'),
       'job_id' => dt('The job ID to run.'),
-    ),
-    'options' => array(
+    ],
+    'options' => [
       'parallel' => dt('Normally jobs are executed one at a time. But if you are certain no conflicts will occur with other currently running jobs you may set this argument to a value of 1 to make the job run in parallel with other running jobs.'),
-    ),
-    'aliases' => array('trpjob-rerun')
-  );
-  $items['tripal-chado-version'] = array(
+    ],
+    'aliases' => ['trpjob-rerun'],
+  ];
+  $items['tripal-chado-version'] = [
     'description' => dt('DEPRECATED. Please see: trp-get-cversion. '),
-    'arguments' => array(),
-    'examples' => array(
+    'arguments' => [],
+    'examples' => [
       'Standard Example' => 'drush tripal-chado-version',
-    ),
-    'aliases' => array('trpchado-ver')
-  );
-  $items['tripal-chadotable-desc'] = array(
+    ],
+    'aliases' => ['trpchado-ver'],
+  ];
+  $items['tripal-chadotable-desc'] = [
     'description' => dt('DEPRECATED. Please see: trp-get-table. '),
-    'arguments' => array(
+    'arguments' => [
       'table_name' => dt('The name of the chado table.'),
-    ),
-    'examples' => array(
-      'By Table Name' => 'drush tripal-chadotable-desc --table_name=feature'
-    ),
-    'options' => array(
+    ],
+    'examples' => [
+      'By Table Name' => 'drush tripal-chadotable-desc --table_name=feature',
+    ],
+    'options' => [
       'section' => dt('Only return the specified section of the schema table description. Possible sections include: description, fields, primary key, unique keys, foreign keys, indexes, referring_tables.'),
-    ),
-    'aliases' => array('trpschema-tbl')
-  );
-  $items['tripal-node-clean'] = array(
+    ],
+    'aliases' => ['trpschema-tbl'],
+  ];
+  $items['tripal-node-clean'] = [
     'description' => dt('DEPRECATED. Please see: trp-clean-nodes.'),
-    'arguments' => array(
+    'arguments' => [
       'module' => dt('The name of the chado-centric module to clean-up.'),
-    ),
-    'examples' => array(
-      'By Table Name' => 'drush tripal-node-clean feature'
-    ),
-    'options' => array(),
-    'aliases' => array('trpnode-cln')
-  );
+    ],
+    'examples' => [
+      'By Table Name' => 'drush tripal-node-clean feature',
+    ],
+    'options' => [],
+    'aliases' => ['trpnode-cln'],
+  ];
 
   return $items;
 }
@@ -172,7 +172,7 @@ function drush_tripal_core_tripal_jobs_launch($username) {
 
   drush_tripal_core_set_user($username);
 
-  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
+  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will " .
     "continue to work but please consider using the 'trp-run-jobs' command.\n\n");
 
   if ($parallel) {
@@ -198,8 +198,8 @@ function drush_tripal_core_tripal_jobs_launch($username) {
  */
 function drush_tripal_core_tripal_jobs_rerun($username, $job_id) {
 
-  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
-      "continue to work but please consider using the 'trp-rerun-job' command.\n\n");
+  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will " .
+    "continue to work but please consider using the 'trp-rerun-job' command.\n\n");
 
   drush_tripal_core_set_user($username);
   $new_job_id = tripal_rerun_job($job_id, FALSE);
@@ -215,8 +215,8 @@ function drush_tripal_core_tripal_jobs_rerun($username, $job_id) {
  * @ingroup tripal_drush
  */
 function drush_tripal_core_tripal_jobs_current() {
-  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
-      "continue to work but please consider using the 'trp-get-currjob' command.\n\n");
+  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will " .
+    "continue to work but please consider using the 'trp-get-currjob' command.\n\n");
 
   drush_tripal_core_trp_get_currjob();
 }
@@ -231,20 +231,20 @@ function drush_tripal_core_tripal_update_mview() {
   $mview_id = drush_get_option('mview_id');
   $table_name = drush_get_option('table_name');
 
-  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
-      "continue to work but please consider using the 'trp-refresh-mview' command.\n\n");
+  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will " .
+    "continue to work but please consider using the 'trp-refresh-mview' command.\n\n");
 
   // Either table_name or mview is required
   if (!$mview_id) {
     if ($table_name) {
       // if table_name supplied use that to get mview_id
       $sql = "SELECT mview_id FROM {tripal_mviews} WHERE mv_table = :mv_table";
-      $results = db_query($sql, array(':mv_table' => $table_name));
+      $results = db_query($sql, [':mv_table' => $table_name]);
       $r = $resuls->fetchObject();
       if (!$r->mview_id) {
         drush_set_error('No Materialized View associated with that table_name.');
       }
-      $mview_id=$r->mview_id;
+      $mview_id = $r->mview_id;
     }
     else {
       drush_set_error('Either mview_id OR table_name are required.');
@@ -267,8 +267,8 @@ function drush_tripal_core_tripal_update_mview() {
  * @ingroup tripal_drush
  */
 function drush_tripal_core_tripal_chado_version() {
-  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
-      "continue to work but please consider using the 'trp-get-cversion' command.\n\n");
+  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will " .
+    "continue to work but please consider using the 'trp-get-cversion' command.\n\n");
 
   drush_tripal_core_trp_get_cversion();
 }
@@ -285,8 +285,8 @@ function drush_tripal_core_tripal_chado_version() {
 function drush_tripal_core_tripal_chadotable_desc($table_name) {
   $section = drush_get_option('section');
 
-  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will ".
-      "continue to work but please consider using the 'trp-get-table' command.\n\n");
+  drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will " .
+    "continue to work but please consider using the 'trp-get-table' command.\n\n");
 
   drush_print("Schema API Description for $table_name:");
   $desc = chado_get_schema($table_name);

+ 9 - 9
legacy/tripal_core/tripal_core.views_default.inc

@@ -1,21 +1,21 @@
 <?php
 /**
  * @file
-* Describes core default views
-*/
+ * Describes core default views
+ */
 
 /**
  * Describes core default views
-*
-* @ingroup tripal_legacy_core
-*/
+ *
+ * @ingroup tripal_legacy_core
+ */
 function tripal_core_views_default_views() {
-  $views = array();
+  $views = [];
 
   // We only want to make this view available if the Search API module is installed
   // and the "Default Node Index has been enabled.
   if (module_exists('search_api')) {
-    $index_enabled = db_query('SELECT enabled FROM search_api_index WHERE machine_name=:name', array(':name' => 'default_node_index'))->fetchField();
+    $index_enabled = db_query('SELECT enabled FROM search_api_index WHERE machine_name=:name', [':name' => 'default_node_index'])->fetchField();
     if ($index_enabled) {
       $view = tripal_core_search_default_node_index();
       $views[$view->name] = $view;
@@ -84,11 +84,11 @@ function tripal_core_search_default_node_index() {
   $handler->display->display_options['filters']['search_api_views_fulltext']['expose']['label'] = 'Keywords';
   $handler->display->display_options['filters']['search_api_views_fulltext']['expose']['operator'] = 'search_api_views_fulltext_op';
   $handler->display->display_options['filters']['search_api_views_fulltext']['expose']['identifier'] = 'keywords';
-  $handler->display->display_options['filters']['search_api_views_fulltext']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['search_api_views_fulltext']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
 
   /* Display: Page */
   $handler = $view->new_display('page', 'Page', 'page');

+ 112 - 111
legacy/tripal_cv/api/tripal_cv.DEPRECATED.inc

@@ -6,8 +6,8 @@
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_cv().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_cv().
  *
  * @see tripal_get_cv().
  */
@@ -17,10 +17,10 @@ function tripal_cv_get_cv($select_values) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_get_cv',
-      '%new_function' => 'tripal_get_cv'
-    )
+    [
+      '%old_function' => 'tripal_cv_get_cv',
+      '%new_function' => 'tripal_get_cv',
+    ]
   );
 
   return tripal_get_cv($select_values);
@@ -28,8 +28,8 @@ function tripal_cv_get_cv($select_values) {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_cv().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_cv().
  *
  * @see tripal_get_cv().
  */
@@ -39,19 +39,19 @@ function tripal_cv_get_cv_by_name($name) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_get_cv_by_name',
-      '%new_function' => 'tripal_get_cv'
-    )
+    [
+      '%old_function' => 'tripal_cv_get_cv_by_name',
+      '%new_function' => 'tripal_get_cv',
+    ]
   );
 
-  return tripal_get_cv(array('name' => $name));
+  return tripal_get_cv(['name' => $name]);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_cv().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_cv().
  *
  * @see tripal_get_cv().
  */
@@ -61,19 +61,19 @@ function tripal_cv_get_cv_by_id($cv_id) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_get_cv_by_id',
-      '%new_function' => 'tripal_get_cv'
-    )
+    [
+      '%old_function' => 'tripal_cv_get_cv_by_id',
+      '%new_function' => 'tripal_get_cv',
+    ]
   );
 
-  return tripal_get_cv(array('cv_id' => $id));
+  return tripal_get_cv(['cv_id' => $id]);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_cv().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_cv().
  *
  * @see tripal_get_cv().
  */
@@ -83,13 +83,13 @@ function tripal_cv_get_cv_id($cv_name) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_get_cv_id',
-      '%new_function' => 'tripal_get_cv'
-    )
+    [
+      '%old_function' => 'tripal_cv_get_cv_id',
+      '%new_function' => 'tripal_get_cv',
+    ]
   );
 
-  $cv = tripal_get_cv(array('name' => $cv_name));
+  $cv = tripal_get_cv(['name' => $cv_name]);
   if (isset($cv->cv_id)) {
     return $cv->cv_id;
   }
@@ -100,8 +100,8 @@ function tripal_cv_get_cv_id($cv_name) {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_cv_select_options().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_cv_select_options().
  *
  * @see tripal_get_cv_select_options().
  */
@@ -111,10 +111,10 @@ function tripal_cv_get_cv_options() {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_get_cv_options',
-      '%new_function' => 'tripal_get_cv_select_options'
-    )
+    [
+      '%old_function' => 'tripal_cv_get_cv_options',
+      '%new_function' => 'tripal_get_cv_select_options',
+    ]
   );
 
   return tripal_get_cv_select_options();
@@ -122,8 +122,8 @@ function tripal_cv_get_cv_options() {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_cvterm().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_cvterm().
  *
  * @see tripal_get_cvterm().
  */
@@ -133,19 +133,19 @@ function tripal_cv_get_cvterm_by_id($cvterm_id) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_get_cvterm_by_id',
-      '%new_function' => 'tripal_get_cvterm'
-    )
+    [
+      '%old_function' => 'tripal_cv_get_cvterm_by_id',
+      '%new_function' => 'tripal_get_cvterm',
+    ]
   );
 
-  return tripal_get_cvterm(array('cvterm_id' => $cvterm_id));
+  return tripal_get_cvterm(['cvterm_id' => $cvterm_id]);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_cvterm().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_cvterm().
  *
  * @see tripal_get_cvterm().
  */
@@ -155,20 +155,20 @@ function tripal_cv_get_cvterm_by_name($name, $cv_id = NULL, $cv_name = 'tripal')
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_get_cvterm_by_name',
-      '%new_function' => 'tripal_get_cvterm'
-    )
+    [
+      '%old_function' => 'tripal_cv_get_cvterm_by_name',
+      '%new_function' => 'tripal_get_cvterm',
+    ]
   );
 
-  $identifiers = array('name' => $name);
+  $identifiers = ['name' => $name];
   if (isset($cv_id)) {
     $identifiers['cv_id'] = $cv_id;
   }
   if (isset($cv_name)) {
-    $identifiers['cv_id'] = array(
-      'name' => $cv_name
-    );
+    $identifiers['cv_id'] = [
+      'name' => $cv_name,
+    ];
   }
 
   return tripal_get_cvterm($identifiers);
@@ -176,8 +176,8 @@ function tripal_cv_get_cvterm_by_name($name, $cv_id = NULL, $cv_name = 'tripal')
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_cvterm().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_cvterm().
  *
  * @see tripal_get_cvterm().
  */
@@ -187,25 +187,26 @@ function tripal_cv_get_cvterm_by_synonym($synonym, $cv_id = NULL, $cv_name = 'tr
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_get_cvterm_by_synonym',
-      '%new_function' => 'tripal_get_cvterm'
-    )
+    [
+      '%old_function' => 'tripal_cv_get_cvterm_by_synonym',
+      '%new_function' => 'tripal_get_cvterm',
+    ]
   );
 
-  return tripal_get_cvterm(array(
-    'synonym' => array(
+  return tripal_get_cvterm([
+    'synonym' => [
       'name' => $synonym,
       'cv_id' => $cv_id,
-      'cv_name' => $cv_name
-    )
-  ));
+      'cv_name' => $cv_name,
+    ],
+  ]);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_cvterm_select_options().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by
+ *   tripal_get_cvterm_select_options().
  *
  * @see tripal_get_cvterm_select_options().
  */
@@ -215,10 +216,10 @@ function tripal_cv_get_cvterm_options($cv_id = 0) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_get_cvterm_options',
-      '%new_function' => 'tripal_get_cvterm_select_options'
-    )
+    [
+      '%old_function' => 'tripal_cv_get_cvterm_options',
+      '%new_function' => 'tripal_get_cvterm_select_options',
+    ]
   );
 
   return tripal_get_cvterm_select_options($cv_id);
@@ -226,8 +227,8 @@ function tripal_cv_get_cvterm_options($cv_id = 0) {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_update_cvtermpath().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_update_cvtermpath().
  *
  * @see tripal_update_cvtermpath().
  */
@@ -237,10 +238,10 @@ function tripal_cv_update_cvtermpath($cvid, $job_id = NULL) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_update_cvtermpath',
-      '%new_function' => 'tripal_update_cvtermpath'
-    )
+    [
+      '%old_function' => 'tripal_cv_update_cvtermpath',
+      '%new_function' => 'tripal_update_cvtermpath',
+    ]
   );
 
   return tripal_update_cvtermpath($cvid, $job_id);
@@ -248,8 +249,8 @@ function tripal_cv_update_cvtermpath($cvid, $job_id = NULL) {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_insert_cv().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_insert_cv().
  *
  * @see tripal_insert_cv().
  */
@@ -259,10 +260,10 @@ function tripal_cv_add_cv($name, $definition) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_add_cv',
-      '%new_function' => 'tripal_insert_cv'
-    )
+    [
+      '%old_function' => 'tripal_cv_add_cv',
+      '%new_function' => 'tripal_insert_cv',
+    ]
   );
 
   return tripal_insert_cv($name, $definition);
@@ -270,8 +271,8 @@ function tripal_cv_add_cv($name, $definition) {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_insert_cvterm().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_insert_cvterm().
  *
  * @see tripal_insert_cvterm().
  */
@@ -281,10 +282,10 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_add_cvterm',
-      '%new_function' => 'tripal_insert_cvterm'
-    )
+    [
+      '%old_function' => 'tripal_cv_add_cvterm',
+      '%new_function' => 'tripal_insert_cvterm',
+    ]
   );
 
   $term['cv_name'] = $defaultcv;
@@ -298,16 +299,16 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
 
   return tripal_insert_cvterm(
     $term,
-    array(
-      'update_existing' => $update
-    )
+    [
+      'update_existing' => $update,
+    ]
   );
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_submit_obo_job().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_submit_obo_job().
  *
  * @see tripal_submit_obo_job().
  */
@@ -317,26 +318,26 @@ function tripal_cv_submit_obo_job($obo_id = NULL, $obo_name = NULL, $obo_url = N
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_submit_obo_job',
-      '%new_function' => 'tripal_submit_obo_job'
-    )
+    [
+      '%old_function' => 'tripal_cv_submit_obo_job',
+      '%new_function' => 'tripal_submit_obo_job',
+    ]
   );
 
   return tripal_submit_obo_job(
-    array(
+    [
       'obo_id' => $obo_id,
-      'name'   => $obo_name,
-      'url'    => $obo_url,
-      'file'   => $obo_file
-    )
+      'name' => $obo_name,
+      'url' => $obo_url,
+      'file' => $obo_file,
+    ]
   );
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_insert_obo().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_insert_obo().
  *
  * @see tripal_insert_obo().
  */
@@ -346,10 +347,10 @@ function tripal_cv_add_obo_ref($name, $path) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_add_obo_ref',
-      '%new_function' => 'chado_insert_obo'
-    )
+    [
+      '%old_function' => 'tripal_cv_add_obo_ref',
+      '%new_function' => 'chado_insert_obo',
+    ]
   );
 
   return tripal_insert_obo($name, $path);
@@ -357,8 +358,8 @@ function tripal_cv_add_obo_ref($name, $path) {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_autocomplete_cvterm().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_autocomplete_cvterm().
  *
  * @see tripal_autocomplete_cvterm().
  */
@@ -368,10 +369,10 @@ function tripal_cv_cvterm_name_autocomplete($cv_id, $string = '') {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_cv_cvterm_name_autocomplete',
-      '%new_function' => 'tripal_autocomplete_cvterm'
-    )
+    [
+      '%old_function' => 'tripal_cv_cvterm_name_autocomplete',
+      '%new_function' => 'tripal_autocomplete_cvterm',
+    ]
   );
 
   return tripal_autocomplete_cvterm($cv_id, $string);

+ 25 - 22
legacy/tripal_cv/api/tripal_cv.api.inc

@@ -48,9 +48,12 @@ function tripal_get_default_cv($table, $field) {
     FROM {tripal_cv_defaults}
     WHERE table_name = :table and field_name = :field
   ";
-  $cv_id = db_query($sql, array(':table' => $table, ':field' => $field))->fetchField();
+  $cv_id = db_query($sql, [
+    ':table' => $table,
+    ':field' => $field,
+  ])->fetchField();
 
-  return tripal_get_cv(array('cv_id' => $cv_id));
+  return tripal_get_cv(['cv_id' => $cv_id]);
 }
 
 /**
@@ -78,7 +81,7 @@ function tripal_get_default_cv($table, $field) {
  */
 function tripal_get_default_cv_table($cv_id) {
   $default = db_select('tripal_cv_defaults', 't')
-    ->fields('t', array('table_name', 'field_name'))
+    ->fields('t', ['table_name', 'field_name'])
     ->condition('cv_id', $cv_id)
     ->execute()
     ->fetchObject();
@@ -111,28 +114,28 @@ function tripal_get_default_cv_table($cv_id) {
 function tripal_get_cvterm_default_select_options($table, $field, $field_desc) {
 
   $default_cv = tripal_get_default_cv($table, $field);
-  $options = array();
+  $options = [];
 
   if ($default_cv) {
     $options = tripal_get_cvterm_select_options($default_cv->cv_id);
 
     if (count($options) == 0) {
       tripal_set_message('There are no ' . $field_desc . '. Please ' .
-          l('add terms',
-              'admin/tripal/loaders/chado_vocabs/chado_cv/' .$default_cv->cv_id. '/cvterm/add',
-              array('attributes' => array('target' => '_blank'))) . ' to the ' .
-          $default_cv->name .' vocabulary.',
-          TRIPAL_WARNING);
+        l('add terms',
+          'admin/tripal/loaders/chado_vocabs/chado_cv/' . $default_cv->cv_id . '/cvterm/add',
+          ['attributes' => ['target' => '_blank']]) . ' to the ' .
+        $default_cv->name . ' vocabulary.',
+        TRIPAL_WARNING);
     }
 
   }
   else {
-    tripal_set_message('There is not a default vocabulary set for ' . $field_desc . '. '.
-        'Please set one using the ' .
-        l('vocabulary defaults configuration page',
-            'admin/tripal/vocab/defaults',
-            array('attributes' => array('target' => '_blank'))) . '.',
-        TRIPAL_WARNING);
+    tripal_set_message('There is not a default vocabulary set for ' . $field_desc . '. ' .
+      'Please set one using the ' .
+      l('vocabulary defaults configuration page',
+        'admin/tripal/vocab/defaults',
+        ['attributes' => ['target' => '_blank']]) . '.',
+      TRIPAL_WARNING);
   }
 
   return $options;
@@ -160,10 +163,10 @@ function tripal_set_default_cv($table, $field, $cv_name, $cv_id = FALSE) {
 
   // Get the CV object
   if ($cv_id) {
-    $cv = tripal_get_cv(array('cv_id' => $cv_id));
+    $cv = tripal_get_cv(['cv_id' => $cv_id]);
   }
   else {
-    $cv = tripal_get_cv(array('name' => $cv_name));
+    $cv = tripal_get_cv(['name' => $cv_name]);
   }
 
   if ($cv) {
@@ -175,24 +178,24 @@ function tripal_set_default_cv($table, $field, $cv_name, $cv_id = FALSE) {
 
     // now add the default value
     $cv_default_id = db_insert('tripal_cv_defaults')
-      ->fields(array(
+      ->fields([
         'table_name' => $table,
         'field_name' => $field,
-        'cv_id'      => $cv->cv_id,
-      ))
+        'cv_id' => $cv->cv_id,
+      ])
       ->execute();
 
     if (!$cv_default_id) {
       tripal_report_error('tripal_chado', TRIPAL_WARNING,
         "Cannot set default vocabulary for %table.%field. Check the error logs.",
-        array('%table' => $table, '%field' => $field));
+        ['%table' => $table, '%field' => $field]);
       return FALSE;
     }
   }
   else {
     tripal_report_error('tripal_chado', TRIPAL_WARNING,
       "Cannot set default vocabulary for %table.%field. The vocabulary name, '%cvname', doesn't exist.",
-      array('%table' => $table, '%field' => $field, '%cvname' => $cv_name));
+      ['%table' => $table, '%field' => $field, '%cvname' => $cv_name]);
     return FALSE;
   }
 }

+ 96 - 96
legacy/tripal_cv/includes/tripal_cv.cv_defaults.inc

@@ -6,15 +6,15 @@
  */
 function tripal_cv_admin_set_defaults_form($form, &$form_state) {
 
-  $form['instructions'] = array(
+  $form['instructions'] = [
     '#markup' => t('Much of the data housed in Chado is typed, meaning that a ' .
-        'controlled vocabulary describes what type of data the record is. For example, '.
-        'a feature must have a "type" which is typically a term from ' .
-        'the Sequence Ontology. Record properties typically have a type as well. '.
-        'Tripal allows the administrator to set a default type for each table in '.
-        'Chado that requires a type from a vocabulary. By default, autocomplete fields, '.
-        'type select boxes and type validation occur using the default vocabularies set below. '),
-  );
+      'controlled vocabulary describes what type of data the record is. For example, ' .
+      'a feature must have a "type" which is typically a term from ' .
+      'the Sequence Ontology. Record properties typically have a type as well. ' .
+      'Tripal allows the administrator to set a default type for each table in ' .
+      'Chado that requires a type from a vocabulary. By default, autocomplete fields, ' .
+      'type select boxes and type validation occur using the default vocabularies set below. '),
+  ];
 
   // get the list of all tables that use the cvterm table as an FK
   $cvterm_schema = chado_get_schema('cvterm');
@@ -22,47 +22,47 @@ function tripal_cv_admin_set_defaults_form($form, &$form_state) {
 
   // get the list of tables that already have default set
   $cv_defaults = db_select('tripal_cv_defaults', 'TCD')
-    ->fields('TCD', array('cv_default_id', 'table_name', 'field_name', 'cv_id'))
+    ->fields('TCD', ['cv_default_id', 'table_name', 'field_name', 'cv_id'])
     ->orderBy('table_name', 'ASC')
     ->execute();
 
   // get the list of vocabularies
   $cvs = tripal_get_cv_select_options();
 
-  $form['settings'] = array(
+  $form['settings'] = [
     '#type' => 'fieldset',
     '#title' => t('Configured Defaults'),
     '#description' => t('The following tables have a default vocabulary'),
     '#tree' => TRUE,
-  );
+  ];
   foreach ($cv_defaults as $cv_default) {
     $cv_default_id = $cv_default->cv_default_id;
-    $cv = tripal_get_cv(array('cv_id' => $cv_default->cv_id));
+    $cv = tripal_get_cv(['cv_id' => $cv_default->cv_id]);
 
-    $form['settings']['existing'][$cv_default_id]["id"] = array(
+    $form['settings']['existing'][$cv_default_id]["id"] = [
       '#type' => 'hidden',
       '#value' => $cv_default_id,
-    );
+    ];
 
     // Display
-    $form['settings']['existing'][$cv_default_id]["table_name-display"] = array(
+    $form['settings']['existing'][$cv_default_id]["table_name-display"] = [
       '#type' => 'markup',
-      '#markup' => $cv_default->table_name
-    );
-    $form['settings']['existing'][$cv_default_id]["field_name-display"] = array(
+      '#markup' => $cv_default->table_name,
+    ];
+    $form['settings']['existing'][$cv_default_id]["field_name-display"] = [
       '#type' => 'markup',
-      '#markup' => $cv_default->field_name
-    );
+      '#markup' => $cv_default->field_name,
+    ];
 
     // Save for use in submit
-    $form['settings']['existing'][$cv_default_id]["table_name"] = array(
+    $form['settings']['existing'][$cv_default_id]["table_name"] = [
       '#type' => 'hidden',
-      '#value' => $cv_default->table_name
-    );
-    $form['settings']['existing'][$cv_default_id]["field_name"] = array(
+      '#value' => $cv_default->table_name,
+    ];
+    $form['settings']['existing'][$cv_default_id]["field_name"] = [
       '#type' => 'hidden',
-      '#value' => $cv_default->field_name
-    );
+      '#value' => $cv_default->field_name,
+    ];
 
     // Selectbox to set the vocabulary
     if (!empty($cv)) {
@@ -72,45 +72,45 @@ function tripal_cv_admin_set_defaults_form($form, &$form_state) {
       $cvs[0] = 'NONE SET';
       $default_cv = 0;
     }
-    $form['settings']['existing'][$cv_default_id]["vocabulary"] = array(
+    $form['settings']['existing'][$cv_default_id]["vocabulary"] = [
       '#type' => 'select',
       '#options' => $cvs,
       '#default_value' => $default_cv,
-    );
+    ];
 
     // Actions
     $view_terms = l('New Vocabulary', 'admin/tripal/loaders/chado_vocabs/chado_cv/add');
     $add_term = '';
     if (!empty($cv)) {
       $view_terms = l(
-          'View Terms',
-          'admin/tripal/loaders/chado_vocabs/chado_cvterms',
-          array('query' => array('cv' => $cv->name))
+        'View Terms',
+        'admin/tripal/loaders/chado_vocabs/chado_cvterms',
+        ['query' => ['cv' => $cv->name]]
       );
 
       $add_term = l(
-          'Add Term',
-          'admin/tripal/loaders/chado_vocabs/chado_cv/' . $cv->cv_id . '/cvterm/add'
+        'Add Term',
+        'admin/tripal/loaders/chado_vocabs/chado_cv/' . $cv->cv_id . '/cvterm/add'
       );
     }
-    $form['settings']['existing'][$cv_default_id]["view-terms"] = array(
+    $form['settings']['existing'][$cv_default_id]["view-terms"] = [
       '#type' => 'markup',
-      '#markup' => $view_terms
-    );
-    $form['settings']['existing'][$cv_default_id]["add-new-term"] = array(
+      '#markup' => $view_terms,
+    ];
+    $form['settings']['existing'][$cv_default_id]["add-new-term"] = [
       '#type' => 'markup',
-      '#markup' => $add_term
-    );
+      '#markup' => $add_term,
+    ];
 
   }
 
-  $form['settings']['submit'] = array(
+  $form['settings']['submit'] = [
     '#type' => 'submit',
-    '#value' => 'Update Defaults'
-  );
+    '#value' => 'Update Defaults',
+  ];
 
   // Adding new CV Defaults
-  $form['new'] = array(
+  $form['new'] = [
     '#type' => 'fieldset',
     '#title' => 'Add New Defaults',
     '#description' => 'You can use the form below to add a default controlled vocabulary
@@ -120,10 +120,10 @@ function tripal_cv_admin_set_defaults_form($form, &$form_state) {
     '#tree' => TRUE,
     '#prefix' => '<div id="new-default">',
     '#suffix' => '</div>',
-  );
+  ];
 
   $tripal_msg = tripal_set_message(
-      'If you are developing a custom module and would like to use the Default Controlled
+    'If you are developing a custom module and would like to use the Default Controlled
       Vocabulary API to flexibly set the controlled vocabulary, then it is better to set
       the default programatically rather than through this interface. To do this <ol>
         <li>Tell Tripal about the table/field you would like to set the default for. This
@@ -137,31 +137,31 @@ function tripal_cv_admin_set_defaults_form($form, &$form_state) {
           <code>tripal_get_cvterm_default_select_options([table name], [field name], [field friendly name])</code>
           if you would like an array of options for use in a select or autocomplete form element.</li></ol>
       ',
-      TRIPAL_NOTICE,
-      array('return_html' => TRUE)
+    TRIPAL_NOTICE,
+    ['return_html' => TRUE]
   );
 
-  $form['new']['instructions'] = array(
+  $form['new']['instructions'] = [
     '#type' => 'markup',
-    '#markup' => $tripal_msg
-  );
+    '#markup' => $tripal_msg,
+  ];
 
   $chado_tables = chado_get_table_names(TRUE);
   $chado_tables[0] = 'Select a Table';
-  $form['new']['table'] = array(
+  $form['new']['table'] = [
     '#type' => 'select',
     '#title' => 'Table Name',
     '#description' => 'The name of the table you would like to set a controlled vocabulary default for.',
     '#options' => $chado_tables,
     '#default_value' => 0,
-    '#ajax' => array(
+    '#ajax' => [
       'callback' => 'tripal_cv_admin_ajax_new_default_field_callback',
       'wrapper' => 'new-default',
-    )
-  );
+    ],
+  ];
 
-  $table = (isset($form_state['values']['new']['table']))? $form_state['values']['new']['table'] : FALSE;
-  $columns = array('Select a Field');
+  $table = (isset($form_state['values']['new']['table'])) ? $form_state['values']['new']['table'] : FALSE;
+  $columns = ['Select a Field'];
   if ($table) {
     // get the table description
     $table_desc = chado_get_schema($table);
@@ -171,27 +171,27 @@ function tripal_cv_admin_set_defaults_form($form, &$form_state) {
       }
     }
   }
-  $form['new']['field'] = array(
+  $form['new']['field'] = [
     '#type' => 'select',
     '#title' => 'Field Name',
     '#description' => 'The name of the field you would like to set a controlled vocabulary default for.',
     '#options' => $columns,
-    '#default_value' => 0
-  );
+    '#default_value' => 0,
+  ];
 
   $cvs[0] = 'Select a Vocabulary';
-  $form['new']['vocabulary'] = array(
+  $form['new']['vocabulary'] = [
     '#type' => 'select',
     '#title' => 'Vocabulary',
     '#description' => 'The default controlled vocabulary you would like to set for this field.',
     '#options' => $cvs,
-    '#default_value' => 0
-  );
+    '#default_value' => 0,
+  ];
 
-  $form['new']['add_new'] = array(
+  $form['new']['add_new'] = [
     '#type' => 'submit',
-    '#value' => 'Set New Default'
-  );
+    '#value' => 'Set New Default',
+  ];
 
   return $form;
 }
@@ -202,10 +202,10 @@ function tripal_cv_admin_set_defaults_form_submit($form, $form_state) {
     foreach ($form_state['values']['settings']['existing'] as $default_cv) {
       if (!empty($default_cv['vocabulary'])) {
         tripal_set_default_cv(
-            $default_cv['table_name'],
-            $default_cv['field_name'],
-            '', // We are passing in the cv_id so we don't need the name
-            $default_cv['vocabulary']
+          $default_cv['table_name'],
+          $default_cv['field_name'],
+          '', // We are passing in the cv_id so we don't need the name
+          $default_cv['vocabulary']
         );
       }
     }
@@ -214,10 +214,10 @@ function tripal_cv_admin_set_defaults_form_submit($form, $form_state) {
   if ($form_state['triggering_element']['#value'] == 'Set New Default') {
     if (!empty($form_state['values']['new']['vocabulary'])) {
       tripal_set_default_cv(
-          $form_state['values']['new']['table'],
-          $form_state['values']['new']['field'],
-          '', // We are passing in the cv_id so we don't need the name
-          $form_state['values']['new']['vocabulary']
+        $form_state['values']['new']['table'],
+        $form_state['values']['new']['field'],
+        '', // We are passing in the cv_id so we don't need the name
+        $form_state['values']['new']['vocabulary']
       );
     }
   }
@@ -234,43 +234,43 @@ function tripal_cv_admin_ajax_new_default_field_callback($form, $form_state) {
 function theme_tripal_cv_admin_set_defaults_form($variables) {
   $element = $variables['element'];
 
-  $header = array(
-    'table_name'      => array('data' => t('Table Name'),         'width' => '20%'),
-    'field_name'      => array('data' => t('Field Name'),         'width' => '20%'),
-    'vocabulary'      => array('data' => t('Default Vocabulary'), 'width' => '30%'),
-    'actions'         => array('data' => t('Actions'),            'width' => '30%'),
-  );
+  $header = [
+    'table_name' => ['data' => t('Table Name'), 'width' => '20%'],
+    'field_name' => ['data' => t('Field Name'), 'width' => '20%'],
+    'vocabulary' => ['data' => t('Default Vocabulary'), 'width' => '30%'],
+    'actions' => ['data' => t('Actions'), 'width' => '30%'],
+  ];
 
-  $rows = array();
+  $rows = [];
 
   foreach ($element['settings']['existing'] as $key => $value) {
     if (is_numeric($key)) {
 
-//       $action_links = '<ul class="links inline">';
-//       if (!empty($value['view-terms'])) {
-//         $action_links .= '<li>' . drupal_render($value['view-terms']) . '</li>';
-//       }
-//       if (!empty($value['add-new-term'])) {
-//         $action_links .= '<li>' . drupal_render($value['add-new-term']) . '</li>';
-//       }
-//       $action_links .= '</li></ul>';
+      //       $action_links = '<ul class="links inline">';
+      //       if (!empty($value['view-terms'])) {
+      //         $action_links .= '<li>' . drupal_render($value['view-terms']) . '</li>';
+      //       }
+      //       if (!empty($value['add-new-term'])) {
+      //         $action_links .= '<li>' . drupal_render($value['add-new-term']) . '</li>';
+      //       }
+      //       $action_links .= '</li></ul>';
 
-      $rows[] = array(
+      $rows[] = [
         drupal_render($value['table_name-display']),
         drupal_render($value['field_name-display']),
         drupal_render($value['vocabulary']),
-        $action_links
-      );
+        $action_links,
+      ];
     }
   }
-  $settings_table = theme('table', array(
+  $settings_table = theme('table', [
     'header' => $header,
-    'rows' => $rows
-  ));
-  $element['settings']['existing'] = array(
+    'rows' => $rows,
+  ]);
+  $element['settings']['existing'] = [
     '#type' => 'markup',
     '#markup' => $settings_table,
-  );
+  ];
 
   // TODO: I believe rendering of the form should not happen here. But rather
   // the form should be returned as is. This way other modules can have access

+ 54 - 34
legacy/tripal_cv/theme/templates/tripal_cv_help.tpl.php

@@ -1,45 +1,65 @@
-  <h3>Module Description:</h3>
-  <p>The Tripal CV (Controlled Vocabularies) Module provides
+<h3>Module Description:</h3>
+<p>The Tripal CV (Controlled Vocabularies) Module provides
     functionality for managing controlled vocabularies and the terms they are
     comprised of. The flexibility and extendibility of the chado schema depends
-    on controlled vocabularies. For example, by using a controlled vocabulary for
+    on controlled vocabularies. For example, by using a controlled vocabulary
+    for
     feature types the chado schema can describe features of any type, even those
     we have not concieved of yet.</p>
 
-  <h3>Setup Instructions:</h3>
-  <p>After installation of the controlled vocabulary module, the following tasks should be performed:</p>
-    <ol>
-        <li><p><b>Set Permissions</b>: By default only the site administrator account has access to create, edit, delete
-   or administer vocabularies and terms. Navigate to the <?php print l('permissions page', 'admin/user/permissions')?> and set the
-   permissions under the 'tripal_cv' section as appropriate for your site. For a simple setup, allow anonymous
-   users access to view content and create a special role for creating, editing and other administrative tasks.</p></li>
+<h3>Setup Instructions:</h3>
+<p>After installation of the controlled vocabulary module, the following tasks
+    should be performed:</p>
+<ol>
+    <li><p><b>Set Permissions</b>: By default only the site administrator
+            account has access to create, edit, delete
+            or administer vocabularies and terms. Navigate to
+            the <?php print l('permissions page', 'admin/user/permissions') ?>
+            and set the
+            permissions under the 'tripal_cv' section as appropriate for your
+            site. For a simple setup, allow anonymous
+            users access to view content and create a special role for creating,
+            editing and other administrative tasks.</p></li>
 
-      <li><p><b>Loading of Ontologies/Controlled Vocabularies</b>: You can access this loader at <?php
+    <li><p><b>Loading of Ontologies/Controlled Vocabularies</b>: You can access
+            this loader at <?php
         print l('Admin->Tripal Management->Tripal CV->Load Ontology With OBO File', 'admin/tripal/loaders/chado_vocabs/obo_loader')
         ?>. This loader allows you to choose from a list of common ontologies or
-        enter the URL or location to an OBO file. Even the list of common
-        ontologies is using a URL ensuring you get the most up to date ontology.</p>
-      <p>NOTE: in some cases, community developed ontologies for your
-        data may not yet be developed. In this case, it is suggested that you begin
-        developement of an ontology using one of the online tools. You might find
-        that many researchers are trying to deal with the same data and are willing
-        to help you in this endevor. </p></li>
-    </ol>
+            enter the URL or location to an OBO file. Even the list of common
+            ontologies is using a URL ensuring you get the most up to date
+            ontology.</p>
+        <p>NOTE: in some cases, community developed ontologies for your
+            data may not yet be developed. In this case, it is suggested that
+            you begin
+            developement of an ontology using one of the online tools. You might
+            find
+            that many researchers are trying to deal with the same data and are
+            willing
+            to help you in this endevor. </p></li>
+</ol>
 
-  <h3>Features of this Module:</h3>
-  <p>Aside from the data loading described above, the Tripal Controlled Vocabulary (CV) module also provides the following functionality:</p>
-    <ul>
-      <li><p><b>Create/Update/Delete A Controlled Vocaulbulary</b>: to create your own controlled vocabulary go to
-        <?php l('the page for adding a vocbulary', 'admin/tripal/tripal_cv/cv/add') ?> and
-        fill out the form provided. To Update/Delete a controlled vocabulary go to
-        <?php print l('the page for editing a vocuabulary', 'admin/tripal/tripal_cv/cv/edit') ?>,
-        select the existing vocabulary you want to modify and then
-        edit it as desired. This only modifies the vocabulary itself. See the next section for adding, removing, editing
-        the terms of a vocabulary.</p></li>
+<h3>Features of this Module:</h3>
+<p>Aside from the data loading described above, the Tripal Controlled Vocabulary
+    (CV) module also provides the following functionality:</p>
+<ul>
+    <li><p><b>Create/Update/Delete A Controlled Vocaulbulary</b>: to create your
+            own controlled vocabulary go to
+        <?php l('the page for adding a vocbulary', 'admin/tripal/tripal_cv/cv/add') ?>
+            and
+            fill out the form provided. To Update/Delete a controlled vocabulary
+            go to
+        <?php print l('the page for editing a vocuabulary', 'admin/tripal/tripal_cv/cv/edit') ?>
+            ,
+            select the existing vocabulary you want to modify and then
+            edit it as desired. This only modifies the vocabulary itself. See
+            the next section for adding, removing, editing
+            the terms of a vocabulary.</p></li>
 
-      <li><p><b>Create a Controlled Vocaulbulary Term</b>: Use
-        <?php print l('the page for adding a new CV term', 'admin/tripal/tripal_cv/cvterm/add') ?>,
-        select the controlled vocabulary you want to add terms to and then fill
-        out the form.</p></li>
+    <li><p><b>Create a Controlled Vocaulbulary Term</b>: Use
+        <?php print l('the page for adding a new CV term', 'admin/tripal/tripal_cv/cvterm/add') ?>
+            ,
+            select the controlled vocabulary you want to add terms to and then
+            fill
+            out the form.</p></li>
 
-    </ul>
+</ul>

+ 1 - 1
legacy/tripal_cv/tripal_cv.views_default.inc

@@ -10,7 +10,7 @@
  * @ingroup tripal_legacy_cv
  */
 function tripal_cv_views_default_views() {
-  $views = array();
+  $views = [];
 
   return $views;
 }

+ 74 - 74
legacy/tripal_db/api/tripal_db.DEPRECATED.inc

@@ -6,8 +6,8 @@
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_db().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_db().
  *
  * @see tripal_get_db().
  */
@@ -17,10 +17,10 @@ function tripal_db_get_db($select_values) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_db_get_db',
-      '%new_function' => 'tripal_get_db'
-    )
+    [
+      '%old_function' => 'tripal_db_get_db',
+      '%new_function' => 'tripal_get_db',
+    ]
   );
 
   return tripal_get_db($select_values);
@@ -28,8 +28,8 @@ function tripal_db_get_db($select_values) {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_db().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_db().
  *
  * @see tripal_get_db().
  */
@@ -39,19 +39,19 @@ function tripal_db_get_db_by_db_id($db_id) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_db_get_db_by_db_id',
-      '%new_function' => 'tripal_get_db'
-    )
+    [
+      '%old_function' => 'tripal_db_get_db_by_db_id',
+      '%new_function' => 'tripal_get_db',
+    ]
   );
 
-  return tripal_get_db(array('db_id' => $db_id));
+  return tripal_get_db(['db_id' => $db_id]);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_db().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_db().
  *
  * @see tripal_get_db().
  */
@@ -61,19 +61,19 @@ function tripal_db_get_db_by_name($name) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_db_get_db_by_name',
-      '%new_function' => 'tripal_get_db'
-    )
+    [
+      '%old_function' => 'tripal_db_get_db_by_name',
+      '%new_function' => 'tripal_get_db',
+    ]
   );
 
-  return tripal_get_db(array('name' => $name));
+  return tripal_get_db(['name' => $name]);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_db_select_options().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_db_select_options().
  *
  * @see tripal_get_db_select_options().
  */
@@ -83,10 +83,10 @@ function tripal_db_get_db_options() {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_db_get_db_options',
-      '%new_function' => 'tripal_get_db_select_options'
-    )
+    [
+      '%old_function' => 'tripal_db_get_db_options',
+      '%new_function' => 'tripal_get_db_select_options',
+    ]
   );
 
   return tripal_get_db_select_options();
@@ -94,8 +94,8 @@ function tripal_db_get_db_options() {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_db().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_db().
  *
  * @see tripal_get_dbxref().
  */
@@ -105,10 +105,10 @@ function tripal_db_get_dbxref($select_values) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_db_get_dbxref',
-      '%new_function' => 'tripal_get_dbxref'
-    )
+    [
+      '%old_function' => 'tripal_db_get_dbxref',
+      '%new_function' => 'tripal_get_dbxref',
+    ]
   );
 
   return tripal_get_dbxref($select_values);
@@ -116,38 +116,38 @@ function tripal_db_get_dbxref($select_values) {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_get_db().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_get_db().
  *
  * @see tripal_get_dbxref().
  */
-function tripal_db_get_dbxref_by_accession($accession, $db_id=0) {
+function tripal_db_get_dbxref_by_accession($accession, $db_id = 0) {
 
   tripal_report_error(
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_db_get_dbxref_by_accession',
-      '%new_function' => 'tripal_get_dbxref'
-    )
+    [
+      '%old_function' => 'tripal_db_get_dbxref_by_accession',
+      '%new_function' => 'tripal_get_dbxref',
+    ]
   );
 
-  $identifiers = array(
-    'accession' => $accession
-  );
+  $identifiers = [
+    'accession' => $accession,
+  ];
   if ($db_id > 0) {
-    $identifiers['db'] = array(
-      'db_id' => $db_id
-    );
+    $identifiers['db'] = [
+      'db_id' => $db_id,
+    ];
   }
   return tripal_get_dbxref($identifiers);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_insert_db().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_insert_db().
  *
  * @see tripal_insert_db().
  */
@@ -157,29 +157,29 @@ function tripal_db_add_db($dbname, $description = '', $url = '', $urlprefix = ''
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_db_add_db',
-      '%new_function' => 'tripal_insert_db'
-    )
+    [
+      '%old_function' => 'tripal_db_add_db',
+      '%new_function' => 'tripal_insert_db',
+    ]
   );
 
   return tripal_insert_db(
-    array(
+    [
       'name' => $dbname,
       'description' => $description,
       'url' => $url,
-      'urlprefix' => $urlprefix
-    ),
-    array(
-      'update_existing' => $update
-    )
+      'urlprefix' => $urlprefix,
+    ],
+    [
+      'update_existing' => $update,
+    ]
   );
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_insert_dbxref().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_insert_dbxref().
  *
  * @see tripal_insert_dbxref().
  */
@@ -189,24 +189,24 @@ function tripal_db_add_dbxref($db_id, $accession, $version = '', $description =
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_db_add_dbxref',
-      '%new_function' => 'tripal_insert_dbxref'
-    )
+    [
+      '%old_function' => 'tripal_db_add_dbxref',
+      '%new_function' => 'tripal_insert_dbxref',
+    ]
   );
 
-  return tripal_insert_dbxref(array(
+  return tripal_insert_dbxref([
     'db_id' => $db_id,
     'accession' => $accession,
     'version' => $version,
-    'description' => $description
-  ));
+    'description' => $description,
+  ]);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_associate_dbxref().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_associate_dbxref().
  *
  * @see tripal_associate_dbxref().
  */
@@ -216,16 +216,16 @@ function tripal_db_add_dbxref_link($linking_table, $dbxref_id, $foreignkey_name,
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_db_add_dbxref_link',
-      '%new_function' => 'tripal_associate_dbxref'
-    )
+    [
+      '%old_function' => 'tripal_db_add_dbxref_link',
+      '%new_function' => 'tripal_associate_dbxref',
+    ]
   );
 
-  if (preg_match('/(\w+)_dbxref/',$linking_table,$matches)) {
+  if (preg_match('/(\w+)_dbxref/', $linking_table, $matches)) {
     $basetable = $matches[1];
 
-    return tripal_associate_dbxref($basetable, $foreignkey_id, array('dbxref_id' => $dbxref_id));
+    return tripal_associate_dbxref($basetable, $foreignkey_id, ['dbxref_id' => $dbxref_id]);
   }
   else {
     return FALSE;

+ 38 - 20
legacy/tripal_db/theme/templates/tripal_db_help.tpl.php

@@ -1,29 +1,47 @@
 <h3>Module Description:</h3>
-<p>The Tripal DB Module provides the ability to add database cross reference to the
-  data in your Tripal Website.  Typically an external database (such as NCBI Genbank, Gene Ontology (GO),
-  stocks database) contains a collection of objects (genomic sequences, vocabulary terms, stocks) that are
-  uniquely identified using an accession number (or identifier).  Data loaded into Tripal can be a
-  associated with these objects in remote databases, and links can appear on pages allowing site visitors
-  to view the associated objects on the remote database\'s website </p>
+<p>The Tripal DB Module provides the ability to add database cross reference to
+    the
+    data in your Tripal Website. Typically an external database (such as NCBI
+    Genbank, Gene Ontology (GO),
+    stocks database) contains a collection of objects (genomic sequences,
+    vocabulary terms, stocks) that are
+    uniquely identified using an accession number (or identifier). Data loaded
+    into Tripal can be a
+    associated with these objects in remote databases, and links can appear on
+    pages allowing site visitors
+    to view the associated objects on the remote database\'s website </p>
 
 <h3>Setup Instructions:</h3>
 <ol>
-    <li><p><b>Set Permissions</b>: By default only the site administrator account has access to
-   or administer databases. Navigate to the <?php print l('permissions page', 'admin/user/permissions')?> and set the
-   permissions under the 'tripal_db' section as appropriate for your site. For a simple setup, allow anonymous
-   users access to view content and create a special role for creating, editing and other administrative tasks.</p></li>
+    <li><p><b>Set Permissions</b>: By default only the site administrator
+            account has access to
+            or administer databases. Navigate to
+            the <?php print l('permissions page', 'admin/user/permissions') ?>
+            and set the
+            permissions under the 'tripal_db' section as appropriate for your
+            site. For a simple setup, allow anonymous
+            users access to view content and create a special role for creating,
+            editing and other administrative tasks.</p></li>
 
-<li><p><b>Adding or Editing an External Databases</b>. Many resources such as NCBI nr or ExPASy SwissProt (to name a few)
-          come pre-loaded with Chado.  However, you can add new entries or edit existing entries. Also, when loading
-          ontologies (controlled vocabularies) using the Tripal CV module new databases are added automaticaly for
-          each ontology.  To enable linking of accession on a page to the page for that accession on the external
-          database, simply add the URL and the URL prefix when adding or editing a database.</p></li>
+    <li><p><b>Adding or Editing an External Databases</b>. Many resources such
+            as NCBI nr or ExPASy SwissProt (to name a few)
+            come pre-loaded with Chado. However, you can add new entries or edit
+            existing entries. Also, when loading
+            ontologies (controlled vocabularies) using the Tripal CV module new
+            databases are added automaticaly for
+            each ontology. To enable linking of accession on a page to the page
+            for that accession on the external
+            database, simply add the URL and the URL prefix when adding or
+            editing a database.</p></li>
 
-<li><p><b>Associate Data with Accessions</b>.  The Tripal loaders (e.g. GFF, OBO) can associate accessions from
-          remote data to genomic features and controlled vocabularies automatically.  Use the loaders to load genomic
-          features and controlled vocabularies respectively.  Additionally, the bulk loader can be used to create
-          loading templates for associating external database accessions.
-         </p></li>
+    <li><p><b>Associate Data with Accessions</b>. The Tripal loaders (e.g. GFF,
+            OBO) can associate accessions from
+            remote data to genomic features and controlled vocabularies
+            automatically. Use the loaders to load genomic
+            features and controlled vocabularies respectively. Additionally, the
+            bulk loader can be used to create
+            loading templates for associating external database accessions.
+        </p></li>
 </ol>
 
 

+ 1 - 2
legacy/tripal_db/tripal_db.views_default.inc

@@ -10,8 +10,7 @@
  * @ingroup tripal_legacy_db
  */
 function tripal_db_views_default_views() {
-  $views = array();
-
+  $views = [];
 
 
   return $views;

+ 184 - 182
legacy/tripal_feature/api/tripal_feature.DEPRECATED.inc

@@ -1,52 +1,53 @@
 <?php
 /**
  * @file
- * Wrapper functions to provide backwards compatibility for the tripal feature api
+ * Wrapper functions to provide backwards compatibility for the tripal feature
+ *   api
  */
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_get_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_get_property().
  *
  * @see chado_get_property().
  */
-function tripal_feature_analysis_get_property($analysis_id = NULL, $feature_id = NUll, $analysisfeature_id = NULL, $property, $cv_name = 'tripal') {
+function tripal_feature_analysis_get_property($analysis_id = NULL, $feature_id = NULL, $analysisfeature_id = NULL, $property, $cv_name = 'tripal') {
 
   tripal_report_error(
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_analysis_get_property',
-      '%new_function' => 'chado_get_property'
-    )
+    [
+      '%old_function' => 'tripal_feature_analysis_get_property',
+      '%new_function' => 'chado_get_property',
+    ]
   );
 
   // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
-      (!$analysis_id and $feature_id)) {
-      tripal_report_error('tripal_feature', TRIPAL_WARNING,
+    (!$analysis_id and $feature_id)) {
+    tripal_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_get_property: Both an analysis ID and feature ID should be specified',
-      array());
+      []);
   }
 
   // get the analysisfeature_id if one is not provided
   if (!$analysisfeature_id) {
-    $columns = array('analysisfeature_id');
-    $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
+    $columns = ['analysisfeature_id'];
+    $values = ['analysis_id' => $analysis_id, 'feature_id' => $feature_id];
     $result = chado_select_record('analysisfeature', $columns, $values);
     $analysisfeature_id = $result[0]->analysisfeature_id;
   }
 
-  $record = array(
+  $record = [
     'table' => 'analysisfeature',
     'id' => $analysisfeature_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
-  );
+  ];
 
   // get the property.
   return chado_get_property($record, $property);
@@ -54,52 +55,52 @@ function tripal_feature_analysis_get_property($analysis_id = NULL, $feature_id =
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_insert_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_insert_property().
  *
  * @see chado_insert_property().
  */
-function tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_id = NUll, $analysisfeature_id = NULL, $property, $value, $update_if_present = 0, $cv_name = 'tripal') {
+function tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_id = NULL, $analysisfeature_id = NULL, $property, $value, $update_if_present = 0, $cv_name = 'tripal') {
 
   tripal_report_error(
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_analysis_insert_property',
-      '%new_function' => 'chado_insert_property'
-    )
+    [
+      '%old_function' => 'tripal_feature_analysis_insert_property',
+      '%new_function' => 'chado_insert_property',
+    ]
   );
 
-    // check that the incoming arguments are correct
+  // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
-      (!$analysis_id and $feature_id)) {
+    (!$analysis_id and $feature_id)) {
     tripal_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_insert_property: Both an analysis ID and feature ID should be specified',
-      array());
+      []);
   }
 
   // get the analysisfeature_id if one is not provided
   if (!$analysisfeature_id) {
-    $columns = array('analysisfeature_id');
-    $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
+    $columns = ['analysisfeature_id'];
+    $values = ['analysis_id' => $analysis_id, 'feature_id' => $feature_id];
     $result = chado_select_record('analysisfeature', $columns, $values);
     $analysisfeature_id = $result[0]->analysisfeature_id;
   }
 
-  $record = array(
+  $record = [
     'table' => 'analysisfeature',
     'id' => $analysisfeature_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
-    'value' => $value
-  );
-  $options = array(
+    'value' => $value,
+  ];
+  $options = [
     'update_if_present' => $update_if_present,
-  );
-  
+  ];
+
   // insert the property.
   return chado_insert_property($record, $property, $options);
 
@@ -107,60 +108,60 @@ function tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_i
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_update_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_update_property().
  *
  * @see chado_update_property().
  */
-function tripal_feature_analysis_update_property($analysis_id = NULL, $feature_id = NUll, $analysisfeature_id = NULL, $property, $value, $insert_if_missing = 0, $cv_name = 'tripal') {
+function tripal_feature_analysis_update_property($analysis_id = NULL, $feature_id = NULL, $analysisfeature_id = NULL, $property, $value, $insert_if_missing = 0, $cv_name = 'tripal') {
 
   tripal_report_error(
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_analysis_update_property',
-      '%new_function' => 'chado_update_property'
-    )
+    [
+      '%old_function' => 'tripal_feature_analysis_update_property',
+      '%new_function' => 'chado_update_property',
+    ]
   );
 
   // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
     (!$analysis_id and $feature_id)) {
-      tripal_report_error('tripal_feature', TRIPAL_WARNING,
+    tripal_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_update_property: Both an analysis ID and feature ID should be specified',
-      array());
+      []);
   }
 
   // get the analysisfeature_id if one is not provided
   if (!$analysisfeature_id) {
-    $columns = array('analysisfeature_id');
-    $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
+    $columns = ['analysisfeature_id'];
+    $values = ['analysis_id' => $analysis_id, 'feature_id' => $feature_id];
     $result = chado_select_record('analysisfeature', $columns, $values);
     $analysisfeature_id = $result[0]->analysisfeature_id;
   }
 
-  $record = array(
+  $record = [
     'table' => 'analysisfeature',
     'id' => $analysisfeature_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
-    'value' => $value
-  );
-  $options = array(
+    'value' => $value,
+  ];
+  $options = [
     'insert_if_missing' => $insert_if_missing,
-  );
-  
+  ];
+
   // update the property.
   return chado_update_property($record, $property, $options);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_update_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_update_property().
  *
  * @see chado_update_property().
  */
@@ -170,68 +171,68 @@ function tripal_feature_analysis_update_property_by_id($analysisfeatureprop_id,
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_analysis_update_property_by_id',
-      '%new_function' => 'chado_update_property'
-    )
+    [
+      '%old_function' => 'tripal_feature_analysis_update_property_by_id',
+      '%new_function' => 'chado_update_property',
+    ]
   );
 
-  $record = array(
+  $record = [
     'table' => 'analysisfeature',
     'prop_id' => $analysisfeatureprop_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
-    'value' => $value
-  );
+    'value' => $value,
+  ];
   // update the property.
   return chado_update_property($record, $property);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_delete_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_delete_property().
  *
  * @see chado_delete_property().
  */
-function tripal_feature_analysis_delete_property($analysis_id = NULL, $feature_id = NUll, $analysisfeature_id = NULL, $property, $cv_name = 'tripal') {
+function tripal_feature_analysis_delete_property($analysis_id = NULL, $feature_id = NULL, $analysisfeature_id = NULL, $property, $cv_name = 'tripal') {
 
   tripal_report_error(
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_analysis_delete_property',
-      '%new_function' => 'chado_delete_property'
-    )
+    [
+      '%old_function' => 'tripal_feature_analysis_delete_property',
+      '%new_function' => 'chado_delete_property',
+    ]
   );
 
   // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
     (!$analysis_id and $feature_id)) {
-      tripal_report_error('tripal_feature', TRIPAL_WARNING,
+    tripal_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_delete_property: Both an analysis ID and feature ID should be specified',
-        array());
+      []);
   }
 
   // get the analysisfeature_id if one is not provided
   if (!$analysisfeature_id) {
-    $columns = array('analysisfeature_id');
-    $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
+    $columns = ['analysisfeature_id'];
+    $values = ['analysis_id' => $analysis_id, 'feature_id' => $feature_id];
     $result = chado_select_record('analysisfeature', $columns, $values);
     $analysisfeature_id = $result[0]->analysisfeature_id;
   }
-  
-  $record = array(
+
+  $record = [
     'table' => 'analysisfeature',
     'id' => $analysisfeature_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
-  );
+  ];
 
   // get the property.
   return chado_delete_property($record, $property);
@@ -240,8 +241,8 @@ function tripal_feature_analysis_delete_property($analysis_id = NULL, $feature_i
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_delete_record().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_delete_record().
  *
  * @see chado_delete_record().
  */
@@ -251,55 +252,55 @@ function tripal_feature_analysis_delete_property_by_id($analysisfeatureprop_id)
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_analysis_delete_property_by_id',
-      '%new_function' => 'chado_delete_record'
-    )
+    [
+      '%old_function' => 'tripal_feature_analysis_delete_property_by_id',
+      '%new_function' => 'chado_delete_record',
+    ]
   );
 
   // construct the array that will match the exact record to update
-  $match = array(
+  $match = [
     'analysisfeatureprop_id' => $analysisfeatureprop_id,
-  );
+  ];
 
   return chado_delete_record('analysisfeatureprop', $match);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_get_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_get_property().
  *
  * @see chado_get_property().
  */
-function tripal_feature_get_property($feature_id, $property, $cv_name='tripal') {
+function tripal_feature_get_property($feature_id, $property, $cv_name = 'tripal') {
 
   tripal_report_error(
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_get_property',
-      '%new_function' => 'chado_get_property'
-    )
+    [
+      '%old_function' => 'tripal_feature_get_property',
+      '%new_function' => 'chado_get_property',
+    ]
   );
-  
-  $record = array(
+
+  $record = [
     'table' => 'feature',
     'id' => $feature_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
-  );
+  ];
 
   return chado_get_property($record, $property);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_insert_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_insert_property().
  *
  * @see chado_insert_property().
  */
@@ -309,32 +310,32 @@ function tripal_feature_insert_property($feature_id, $property, $value, $update_
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_insert_property',
-      '%new_function' => 'chado_insert_property'
-    )
+    [
+      '%old_function' => 'tripal_feature_insert_property',
+      '%new_function' => 'chado_insert_property',
+    ]
   );
 
-  $record = array(
+  $record = [
     'table' => 'feature',
     'id' => $feature_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
     'value' => $value,
-  );
-  $options = array(
+  ];
+  $options = [
     'update_if_present' => $update_if_present,
-  );
-  
+  ];
+
   return chado_insert_property($record, $property, $options);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_update_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_update_property().
  *
  * @see chado_update_property().
  */
@@ -344,31 +345,31 @@ function tripal_feature_update_property($feature_id, $property, $value, $insert_
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_update_property',
-      '%new_function' => 'chado_update_property'
-    )
+    [
+      '%old_function' => 'tripal_feature_update_property',
+      '%new_function' => 'chado_update_property',
+    ]
   );
 
-  $record = array(
+  $record = [
     'table' => 'feature',
     'id' => $feature_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
     'value' => $value,
-  );
-  $options = array(
+  ];
+  $options = [
     'insert_if_missing' => insert_if_missing,
-  );
+  ];
   return chado_update_property($record, $property, $options);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_update_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_update_property().
  *
  * @see chado_update_property().
  */
@@ -378,59 +379,59 @@ function tripal_feature_update_property_by_id($featureprop_id, $property, $value
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_update_property_by_id',
-      '%new_function' => 'chado_update_property'
-    )
+    [
+      '%old_function' => 'tripal_feature_update_property_by_id',
+      '%new_function' => 'chado_update_property',
+    ]
   );
 
-  $record = array(
+  $record = [
     'table' => 'feature',
     'prop_id' => $featureprop_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
     'value' => $value,
-  );
+  ];
   return chado_update_property($record, $property);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_delete_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_delete_property().
  *
  * @see chado_delete_property().
  */
-function tripal_feature_delete_property($feature_id, $property, $cv_name='tripal') {
+function tripal_feature_delete_property($feature_id, $property, $cv_name = 'tripal') {
 
   tripal_report_error(
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_delete_property',
-      '%new_function' => 'chado_delete_property'
-    )
+    [
+      '%old_function' => 'tripal_feature_delete_property',
+      '%new_function' => 'chado_delete_property',
+    ]
   );
-  
-  $record = array(
+
+  $record = [
     'table' => 'feature',
     'id' => $feature_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => $cv_name,
-  );
+  ];
 
   return chado_delete_property($record, $property);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_delete_record().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_delete_record().
  *
  * @see chado_delete_record().
  */
@@ -440,24 +441,25 @@ function tripal_feature_delete_property_by_id($featureprop_id) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_delete_property_by_id',
-      '%new_function' => 'chado_delete_record'
-    )
+    [
+      '%old_function' => 'tripal_feature_delete_property_by_id',
+      '%new_function' => 'chado_delete_record',
+    ]
   );
 
   // construct the array that will match the exact record to update
-  $match = array(
+  $match = [
     'featureprop_id' => $featureprop_id,
-  );
+  ];
 
   return chado_delete_record('featureprop', $match);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_reverse_compliment_sequence().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by
+ *   tripal_reverse_compliment_sequence().
  *
  * @see tripal_reverse_compliment_sequence().
  */
@@ -467,10 +469,10 @@ function tripal_feature_reverse_complement($sequence) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_reverse_complement',
-      '%new_function' => 'tripal_reverse_compliment_sequence'
-    )
+    [
+      '%old_function' => 'tripal_feature_reverse_complement',
+      '%new_function' => 'tripal_reverse_compliment_sequence',
+    ]
   );
 
   return tripal_reverse_compliment_sequence($sequence);
@@ -478,8 +480,8 @@ function tripal_feature_reverse_complement($sequence) {
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_associate_dbxref().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_associate_dbxref().
  *
  * @see tripal_associate_dbxref().
  */
@@ -489,26 +491,26 @@ function tripal_feature_add_dbxref($feature_id, $dbname, $accession) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_add_dbxref',
-      '%new_function' => 'tripal_associate_dbxref'
-    )
+    [
+      '%old_function' => 'tripal_feature_add_dbxref',
+      '%new_function' => 'tripal_associate_dbxref',
+    ]
   );
 
   return tripal_associate_dbxref(
     'feature',
     $feature_id,
-    array(
+    [
       'accession' => $accession,
-      'db_name' => $dbname
-    )
+      'db_name' => $dbname,
+    ]
   );
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by tripal_associate_cvterm().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by tripal_associate_cvterm().
  *
  * @see tripal_associate_cvterm().
  */
@@ -518,18 +520,18 @@ function tripal_feature_add_cvterm($feature_id, $cvname, $cvterm) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_feature_add_cvterm',
-      '%new_function' => 'tripal_associate_cvterm'
-    )
+    [
+      '%old_function' => 'tripal_feature_add_cvterm',
+      '%new_function' => 'tripal_associate_cvterm',
+    ]
   );
 
   return tripal_associate_cvterm(
     'feature',
     $feature_id,
-    array(
+    [
       'name' => $cvterm,
-      'cv_name' => $cvname
-    )
+      'cv_name' => $cvname,
+    ]
   );
 }

+ 72 - 70
legacy/tripal_feature/includes/tripal_feature.admin.inc

@@ -13,7 +13,7 @@ function tripal_feature_admin_feature_view() {
   $output = '';
 
   // set the breadcrumb
-  $breadcrumb = array();
+  $breadcrumb = [];
   $breadcrumb[] = l('Home', '<front>');
   $breadcrumb[] = l('Administration', 'admin');
   $breadcrumb[] = l('Tripal', 'admin/tripal');
@@ -22,7 +22,7 @@ function tripal_feature_admin_feature_view() {
   drupal_set_breadcrumb($breadcrumb);
 
   // Add the view
-  $view = views_embed_view('tripal_feature_admin_features','default');
+  $view = views_embed_view('tripal_feature_admin_features', 'default');
   if (isset($view)) {
     $output .= $view;
   }
@@ -32,7 +32,7 @@ function tripal_feature_admin_feature_view() {
       . 'administrative interface are disabled. <strong>Click each of the following links to '
       . 'enable the pertinent views</strong>:</p>';
     $output .= '<ul>';
-      $output .= '<li>'.l('Features View', 'admin/tripal/legacy/tripal_feature/views/features/enable').'</li>';
+    $output .= '<li>' . l('Features View', 'admin/tripal/legacy/tripal_feature/views/features/enable') . '</li>';
     $output .= '</ul>';
   }
 
@@ -58,93 +58,93 @@ function tripal_feature_admin() {
 
   // FEATURE PAGE TITLES
   // Using the Chado Node: Title & Path API
-  $details = array(
+  $details = [
     'module' => 'tripal_feature',
     'content_type' => 'chado_feature',
-      // An array of options to use under "Page Titles"
-      // the key should be the token and the value should be the human-readable option
-    'options' => array(
+    // An array of options to use under "Page Titles"
+    // the key should be the token and the value should be the human-readable option
+    'options' => [
       '[feature.name]' => 'Feature Name Only',
       '[feature.uniquename]' => 'Feature Unique Name Only',
       // there should always be one options matching the unique constraint.
-      '[feature.name], [feature.uniquename] ([feature.type_id>cvterm.name]) [feature.organism_id>organism.genus] [feature.organism_id>organism.species]' => 'Unique Contraint: Includes the name, uniquename, type and scientific name'
-    ),
+      '[feature.name], [feature.uniquename] ([feature.type_id>cvterm.name]) [feature.organism_id>organism.genus] [feature.organism_id>organism.species]' => 'Unique Contraint: Includes the name, uniquename, type and scientific name',
+    ],
     // the token indicating the unique constraint in the options array
-    'unique_option' => '[feature.name], [feature.uniquename] ([feature.type_id>cvterm.name]) [feature.organism_id>organism.genus] [feature.organism_id>organism.species]'
-  );
+    'unique_option' => '[feature.name], [feature.uniquename] ([feature.type_id>cvterm.name]) [feature.organism_id>organism.genus] [feature.organism_id>organism.species]',
+  ];
   // This call adds the configuration form to your current form
   // This sub-form handles it's own validation & submit
   chado_add_admin_form_set_title($form, $form_state, $details);
 
   // FEATURE NODE URL
   // Using the Chado Node: Title & Path API
-  $details = array(
+  $details = [
     'module' => 'tripal_feature',
     'content_type' => 'chado_feature',
-      // An array of options to use under "Page URL"
-      // the key should be the token and the value should be the human-readable option
-    'options' => array(
+    // An array of options to use under "Page URL"
+    // the key should be the token and the value should be the human-readable option
+    'options' => [
       '/feature/[feature.feature_id]' => 'Feature ID',
-        // there should always be one options matching the unique constraint.
-      '/feature/[feature.organism_id>organism.genus]/[feature.organism_id>organism.species]/[feature.type_id>cvterm.name]/[feature.uniquename]' => 'Unique Contraint: Includes the name, uniquename, type and scientific name'
-    )
-  );
+      // there should always be one options matching the unique constraint.
+      '/feature/[feature.organism_id>organism.genus]/[feature.organism_id>organism.species]/[feature.type_id>cvterm.name]/[feature.uniquename]' => 'Unique Contraint: Includes the name, uniquename, type and scientific name',
+    ],
+  ];
   // This call adds the configuration form to your current form
   // This sub-form handles it's own validation & submit
   chado_add_admin_form_set_url($form, $form_state, $details);
 
   // FEATURE BROWSER
-  $form['browser'] = array(
-     '#type' => 'fieldset',
-     '#title' => t('Feature Browser'),
-     '#collapsible' => TRUE,
-     '#collapsed' => TRUE,
-  );
-  $form['browser']['browser_desc'] = array(
-     '#markup' => t('A feature browser can be added to an organism page to allow users to quickly ' .
-        'access a feature.  This will most likely not be the ideal mechanism for accessing feature ' .
-        'information, especially for large sites, but it will alow users exploring the site (such ' .
-        'as students) to better understand the data types available on the site.'),
-
-  );
-  $form['browser']['feature_types'] = array(
-     '#title'       => t('Feature Types'),
-     '#type'        => 'textarea',
-     '#description' => t("Enter the Sequence Ontology (SO) terms for the feature types that " .
-                         "will be shown in the feature browser."),
-     '#default_value' => variable_get('chado_browser_feature_types', 'gene mRNA'),
-  );
-
-
-  $form['browser']['set_browse_button'] = array(
-     '#type' => 'submit',
-     '#value' => t('Set Browser'),
-     '#weight' => 2,
-  );
+  $form['browser'] = [
+    '#type' => 'fieldset',
+    '#title' => t('Feature Browser'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  ];
+  $form['browser']['browser_desc'] = [
+    '#markup' => t('A feature browser can be added to an organism page to allow users to quickly ' .
+      'access a feature.  This will most likely not be the ideal mechanism for accessing feature ' .
+      'information, especially for large sites, but it will alow users exploring the site (such ' .
+      'as students) to better understand the data types available on the site.'),
+
+  ];
+  $form['browser']['feature_types'] = [
+    '#title' => t('Feature Types'),
+    '#type' => 'textarea',
+    '#description' => t("Enter the Sequence Ontology (SO) terms for the feature types that " .
+      "will be shown in the feature browser."),
+    '#default_value' => variable_get('chado_browser_feature_types', 'gene mRNA'),
+  ];
+
+
+  $form['browser']['set_browse_button'] = [
+    '#type' => 'submit',
+    '#value' => t('Set Browser'),
+    '#weight' => 2,
+  ];
 
   // FEATURE SUMMARY REPORT
-  $form['summary'] = array(
-     '#type' => 'fieldset',
-     '#title' => t('Feature Summary Report'),
-     '#collapsible' => TRUE,
-     '#collapsed' => TRUE,
-  );
-  $form['summary']['feature_mapping'] = array(
-     '#title' => 'Map feature types',
-     '#description' => t('You may specify which Sequence Ontology (SO) terms to show in the ' .
-        'feature summary report by listing them in the following text area.   Enter one per line. ' .
-        'If left blank, all SO terms for all features will be shown in the report. Only those terms ' .
-        'listed below will be shown in the report. Terms will appear in the report in the same order listed. To rename a ' .
-        'SO term to be more human readable form, use an \'=\' sign after the SO term (e.g. \'polypeptide = Protein\')'),
-     '#type' => 'textarea',
-     '#rows' => 15,
-     '#default_value' => variable_get('tripal_feature_summary_report_mapping', ''),
-  );
-  $form['summary']['set_summary_button'] = array(
-     '#type' => 'submit',
-     '#value' => t('Set Summary'),
-     '#weight' => 2,
-  );
+  $form['summary'] = [
+    '#type' => 'fieldset',
+    '#title' => t('Feature Summary Report'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  ];
+  $form['summary']['feature_mapping'] = [
+    '#title' => 'Map feature types',
+    '#description' => t('You may specify which Sequence Ontology (SO) terms to show in the ' .
+      'feature summary report by listing them in the following text area.   Enter one per line. ' .
+      'If left blank, all SO terms for all features will be shown in the report. Only those terms ' .
+      'listed below will be shown in the report. Terms will appear in the report in the same order listed. To rename a ' .
+      'SO term to be more human readable form, use an \'=\' sign after the SO term (e.g. \'polypeptide = Protein\')'),
+    '#type' => 'textarea',
+    '#rows' => 15,
+    '#default_value' => variable_get('tripal_feature_summary_report_mapping', ''),
+  ];
+  $form['summary']['set_summary_button'] = [
+    '#type' => 'submit',
+    '#value' => t('Set Summary'),
+    '#weight' => 2,
+  ];
 
   return system_settings_form($form);
 }
@@ -156,7 +156,7 @@ function tripal_feature_admin() {
  */
 function tripal_feature_admin_validate($form, &$form_state) {
   global $user;  // we need access to the user info
-  $job_args = array();
+  $job_args = [];
 
   variable_set('chado_browser_feature_types', $form_state['values']['feature_types']);
 
@@ -175,6 +175,8 @@ function tripal_feature_admin_validate($form, &$form_state) {
  * Not meant to be called directly.
  */
 function tripal_feature_admin_summary_sort($a, $b) {
-  if ($a['total_features'] == $b['total_features']) return 0;
+  if ($a['total_features'] == $b['total_features']) {
+    return 0;
+  }
   return $b['total_features'] - $a['total_features'];
 }

+ 290 - 249
legacy/tripal_feature/includes/tripal_feature.chado_node.inc

@@ -13,27 +13,27 @@
  * @ingroup tripal_legacy_feature
  */
 function tripal_feature_node_info() {
-  $nodes = array();
+  $nodes = [];
 
-  $nodes['chado_feature'] = array(
-    'name'        => t('Feature (Tripal v2 legacy)'),
-    'base'        => 'chado_feature',
+  $nodes['chado_feature'] = [
+    'name' => t('Feature (Tripal v2 legacy)'),
+    'base' => 'chado_feature',
     'description' => t('A feature from the chado database'),
-    'has_title'   => TRUE,
-    'locked'      => TRUE,
-    'chado_node_api' => array(
+    'has_title' => TRUE,
+    'locked' => TRUE,
+    'chado_node_api' => [
       'base_table' => 'feature',
       'hook_prefix' => 'chado_feature',
-      'record_type_title' => array(
+      'record_type_title' => [
         'singular' => t('Feature'),
-        'plural' => t('Features')
-      ),
-      'sync_filters' => array(
+        'plural' => t('Features'),
+      ],
+      'sync_filters' => [
         'type_id' => TRUE,
-        'organism_id' => TRUE
-      ),
-    )
-  );
+        'organism_id' => TRUE,
+      ],
+    ],
+  ];
   return $nodes;
 }
 
@@ -44,7 +44,7 @@ function tripal_feature_node_info() {
  */
 function chado_feature_form($node, &$form_state) {
 
-  $form = array();
+  $form = [];
 
   // Default values can come in the following ways:
   //
@@ -55,121 +55,121 @@ function chado_feature_form($node, &$form_state) {
   //    form elements and the form is being rebuilt
   //
   // set form field defaults
-  $feature      = null;
-  $feature_id   = null;
-  $uniquename   = '';
-  $fname        = '';
+  $feature = NULL;
+  $feature_id = NULL;
+  $uniquename = '';
+  $fname = '';
   $feature_type = '';
-  $organism_id  = '';
-  $residues     = '';
-  $is_obsolete  = '';
-  $analyses     = '';
-  $references   = '';
-  $synonyms     = '';
+  $organism_id = '';
+  $residues = '';
+  $is_obsolete = '';
+  $analyses = '';
+  $references = '';
+  $synonyms = '';
 
   // if we are editing an existing node then the feature is already part of the node
   if (property_exists($node, 'feature')) {
     $feature = $node->feature;
     $feature = chado_expand_var($feature, 'field', 'feature.residues');
-    $feature_id   = $feature->feature_id;
-    $uniquename   = $feature->uniquename;
-    $fname        = $feature->name;
+    $feature_id = $feature->feature_id;
+    $uniquename = $feature->uniquename;
+    $fname = $feature->name;
     $feature_type = $feature->type_id->name;
-    $organism_id  = $feature->organism_id->organism_id;
-    $residues     = $feature->residues;
-    $is_obsolete  = $feature->is_obsolete;
+    $organism_id = $feature->organism_id->organism_id;
+    $residues = $feature->residues;
+    $is_obsolete = $feature->is_obsolete;
 
     // get the synonyms from a previous post
     $synonyms = '';
-    if(property_exists($node, 'synonyms')) {
+    if (property_exists($node, 'synonyms')) {
       $synonyms = $node->synonyms;
     }
 
     // get synonyms from the database if we don't already have them
     if (!$synonyms) {
-      $options = array('return_array' => 1);
+      $options = ['return_array' => 1];
       $feature = chado_expand_var($feature, 'table', 'feature_synonym', $options);
-      $feature_synonyms = (isset($feature->feature_synonym)) ? $feature->feature_synonym : array();
+      $feature_synonyms = (isset($feature->feature_synonym)) ? $feature->feature_synonym : [];
       foreach ($feature_synonyms as $index => $synonym) {
         $synonyms .= $synonym->synonym_id->name . "\n";
       }
     }
     // keep track of the feature id
-    $form['feature_id'] = array(
+    $form['feature_id'] = [
       '#type' => 'value',
       '#value' => $feature_id,
-    );
+    ];
   }
   // if we are re constructing the form from a failed validation or ajax callback
   // then use the $form_state['values'] values
   if (array_key_exists('values', $form_state) and isset($form_state['values']['uniquename'])) {
-    $uniquename   = $form_state['values']['uniquename'];
-    $fname        = $form_state['values']['fname'];
+    $uniquename = $form_state['values']['uniquename'];
+    $fname = $form_state['values']['fname'];
     $feature_type = $form_state['values']['feature_type'];
-    $organism_id  = $form_state['values']['organism_id'];
-    $residues     = $form_state['values']['residues'];
-    $is_obsolete  = $form_state['values']['is_obsolete'];
-    $synonyms     = $form_state['values']['synonyms'];
+    $organism_id = $form_state['values']['organism_id'];
+    $residues = $form_state['values']['residues'];
+    $is_obsolete = $form_state['values']['is_obsolete'];
+    $synonyms = $form_state['values']['synonyms'];
   }
   // if we are re building the form from after submission (from ajax call) then
   // the values are in the $form_state['input'] array
   if (array_key_exists('input', $form_state) and !empty($form_state['input'])) {
-    $uniquename   = $form_state['input']['uniquename'];
-    $fname        = $form_state['input']['fname'];
+    $uniquename = $form_state['input']['uniquename'];
+    $fname = $form_state['input']['fname'];
     $feature_type = $form_state['input']['feature_type'];
-    $organism_id  = $form_state['input']['organism_id'];
-    $residues     = $form_state['input']['residues'];
-    $is_obsolete  = array_key_exists('is_obsolete', $form_state['input']) ? $form_state['input']['is_obsolete'] : FALSE;
-    $synonyms     = $form_state['input']['synonyms'];
+    $organism_id = $form_state['input']['organism_id'];
+    $residues = $form_state['input']['residues'];
+    $is_obsolete = array_key_exists('is_obsolete', $form_state['input']) ? $form_state['input']['is_obsolete'] : FALSE;
+    $synonyms = $form_state['input']['synonyms'];
   }
 
-  $form['fname']= array(
+  $form['fname'] = [
     '#type' => 'textfield',
     '#title' => t('Feature Name'),
     '#required' => TRUE,
     '#default_value' => $fname,
     '#description' => t('Enter the name used by humans to refer to this feature.'),
-    '#maxlength' => 255
-  );
-  $form['uniquename']= array(
+    '#maxlength' => 255,
+  ];
+  $form['uniquename'] = [
     '#type' => 'textfield',
     '#title' => t('Unique Feature Name'),
     '#required' => TRUE,
     '#default_value' => $uniquename,
     '#description' => t('Enter a unique name for this feature.  This name must be unique for the organism and feature type.'),
-    '#maxlength' => 255
-  );
+    '#maxlength' => 255,
+  ];
 
   //$type_options = tripal_get_cvterm_default_select_options('feature', 'type_id', 'feature types');
   //$type_options[0] = 'Select a Type';
   $type_cv = tripal_get_default_cv('feature', 'type_id');
   $cv_id = $type_cv->cv_id;
 
-  $form['feature_type'] = array(
-   '#title'       => t('Feature Type'),
-   '#type'        => 'textfield',
-   '#description' => t("Choose the feature type."),
-   '#required'    => TRUE,
-   '#default_value' => $feature_type,
-   '#autocomplete_path' => "aadmin/tripal/storage/chado/auto_name/cvterm/$cv_id",
-  );
+  $form['feature_type'] = [
+    '#title' => t('Feature Type'),
+    '#type' => 'textfield',
+    '#description' => t("Choose the feature type."),
+    '#required' => TRUE,
+    '#default_value' => $feature_type,
+    '#autocomplete_path' => "aadmin/tripal/storage/chado/auto_name/cvterm/$cv_id",
+  ];
 
   // get the list of organisms
   $sql = "SELECT * FROM {Organism} ORDER BY genus, species";
   $org_rset = chado_query($sql);
-  $organisms = array();
+  $organisms = [];
   $organisms[''] = '';
   while ($organism = $org_rset->fetchObject()) {
     $organisms[$organism->organism_id] = "$organism->genus $organism->species ($organism->common_name)";
   }
-  $form['organism_id'] = array(
-    '#title'       => t('Organism'),
-    '#type'        => t('select'),
+  $form['organism_id'] = [
+    '#title' => t('Organism'),
+    '#type' => t('select'),
     '#description' => t("Choose the organism with which this feature is associated"),
-    '#required'    => TRUE,
+    '#required' => TRUE,
     '#default_value' => $organism_id,
-    '#options'     => $organisms,
-  );
+    '#options' => $organisms,
+  ];
 
   // Get synonyms
   $syn_text = '';
@@ -183,66 +183,72 @@ function chado_feature_form($node, &$form_state) {
       $syn_text = $synonyms;
     }
   }
-  $form['synonyms']= array(
+  $form['synonyms'] = [
     '#type' => 'textarea',
     '#title' => t('Synonyms'),
     '#required' => FALSE,
     '#default_value' => $syn_text,
     '#description' => t('Enter alternate names (synonmys) for this feature to help in searching and identification. You may enter as many alternate names as needed each on different lines.'),
-  );
+  ];
 
-  $form['residues']= array(
+  $form['residues'] = [
     '#type' => 'textarea',
     '#title' => t('Residues'),
     '#required' => FALSE,
     '#default_value' => $residues,
     '#description' => t('Enter the nucelotide sequences for this feature'),
-  );
+  ];
 
   $checked = '';
   if ($is_obsolete == 't') {
     $checked = '1';
   }
-  $form['is_obsolete']= array(
+  $form['is_obsolete'] = [
     '#type' => 'checkbox',
     '#title' => t('Is Obsolete'),
     '#required' => FALSE,
     '#default_value' => $checked,
     '#description' => t('Check this box if this sequence should be retired'),
-  );
+  ];
 
   // PROPERTIES FORM
   //---------------------------------------------
   $prop_cv = tripal_get_default_cv('featureprop', 'type_id');
   $cv_id = $prop_cv ? $prop_cv->cv_id : NULL;
-  $details = array(
-    'property_table' => 'featureprop',      // the name of the prop table
-    'chado_id' => $feature_id,              // the value of feature_id for this record
-    'cv_id' => $cv_id                       // the cv.cv_id of the cv governing featureprop.type_id
-  );
+  $details = [
+    'property_table' => 'featureprop',
+    // the name of the prop table
+    'chado_id' => $feature_id,
+    // the value of feature_id for this record
+    'cv_id' => $cv_id
+    // the cv.cv_id of the cv governing featureprop.type_id
+  ];
   chado_add_node_form_properties($form, $form_state, $details);
 
   // ADDITIONAL DBXREFS FORM
   //---------------------------------------------
-  $details = array(
-    'linking_table' => 'feature_dbxref',  // the name of the _dbxref table
-    'base_foreign_key' => 'feature_id',   // the name of the key in your base chado table
-    'base_key_value' => $feature_id       // the value of feature_id for this record
-  );
+  $details = [
+    'linking_table' => 'feature_dbxref',
+    // the name of the _dbxref table
+    'base_foreign_key' => 'feature_id',
+    // the name of the key in your base chado table
+    'base_key_value' => $feature_id
+    // the value of feature_id for this record
+  ];
   chado_add_node_form_dbxrefs($form, $form_state, $details);
 
   // RELATIONSHIPS FORM
   //---------------------------------------------
   $relationship_cv = tripal_get_default_cv('feature_relationship', 'type_id');
   $cv_id = $relationship_cv ? $relationship_cv->cv_id : NULL;
-  $details = array(
+  $details = [
     'relationship_table' => 'feature_relationship',
     'base_table' => 'feature',
     'base_foreign_key' => 'feature_id',
     'base_key_value' => $feature_id,
     'nodetype' => 'feature',
-    'cv_id' => $cv_id
-  );
+    'cv_id' => $cv_id,
+  ];
   chado_add_node_form_relationships($form, $form_state, $details);
 
   return $form;
@@ -265,7 +271,7 @@ function chado_feature_validate($node, $form, &$form_state) {
   // Since this validate can be called on AJAX and Deletion of the node
   // we need to make this check to ensure queries are not executed
   // without the proper values.
-  if(property_exists($node, "op") and $node->op != 'Save') {
+  if (property_exists($node, "op") and $node->op != 'Save') {
     return;
   }
 
@@ -276,19 +282,19 @@ function chado_feature_validate($node, $form, &$form_state) {
   }
 
   // remove surrounding white-space on submitted values
-  $node->uniquename   = property_exists($node, 'uniquename') ? trim($node->uniquename) : '';
-  $node->fname        = property_exists($node, 'fname') ? trim($node->fname) : '';
+  $node->uniquename = property_exists($node, 'uniquename') ? trim($node->uniquename) : '';
+  $node->fname = property_exists($node, 'fname') ? trim($node->fname) : '';
   $node->feature_type = property_exists($node, 'feature_type') ? trim($node->feature_type) : '';
-  $node->residues     = property_exists($node, 'residues') ? trim($node->residues) : '';
+  $node->residues = property_exists($node, 'residues') ? trim($node->residues) : '';
 
   // Validating for an update
   if (property_exists($node, 'nid')) {
 
     // make sure the feature type is a real sequence ontology term
-    $type = tripal_get_cvterm(array(
+    $type = tripal_get_cvterm([
       'name' => $node->feature_type,
-      'cv_id' => array('name' =>'sequence')
-    ));
+      'cv_id' => ['name' => 'sequence'],
+    ]);
     if (!$type) {
       form_set_error('feature_type', t("The feature type is not a valid name from the Sequence Ontology."));
     }
@@ -307,8 +313,12 @@ function chado_feature_validate($node, $form, &$form_state) {
           CVT.name         = :cvtname AND
           NOT f.feature_id = :feature_id
       ";
-      $args = array(':uname' => $node->uniquename, ':organism_id' => $node->organism_id,
-        ':cvtname' => $node->feature_type, ':feature_id' => $node->feature_id);
+      $args = [
+        ':uname' => $node->uniquename,
+        ':organism_id' => $node->organism_id,
+        ':cvtname' => $node->feature_type,
+        ':feature_id' => $node->feature_id,
+      ];
       $result = chado_query($sql, $args)->fetchObject();
       if ($result) {
         form_set_error('uniquename', t("Feature update cannot proceed. The feature name '$node->uniquename' is not unique for this organism. Please provide a unique name for this feature."));
@@ -319,10 +329,10 @@ function chado_feature_validate($node, $form, &$form_state) {
   else {
 
     // make sure the feature type is a real sequence ontology term
-    $type = tripal_get_cvterm(array(
+    $type = tripal_get_cvterm([
       'name' => $node->feature_type,
-      'cv_id' => array('name' => 'sequence')
-    ));
+      'cv_id' => ['name' => 'sequence'],
+    ]);
     if (!$type) {
       form_set_error('feature_type', t("The feature type is not a valid name from the Sequence Ontology."));
     }
@@ -338,7 +348,11 @@ function chado_feature_validate($node, $form, &$form_state) {
         F.organism_id = :organism_id AND
         CVT.name      = :cvtname
     ";
-    $args = array(':name' => $node->uniquename, ':organism_id' => $node->organism_id, ':cvtname' => $node->feature_type);
+    $args = [
+      ':name' => $node->uniquename,
+      ':organism_id' => $node->organism_id,
+      ':cvtname' => $node->feature_type,
+    ];
 
     $result = chado_query($sql, $args)->fetchObject();
     if ($result) {
@@ -352,21 +366,22 @@ function chado_feature_validate($node, $form, &$form_state) {
  *
  * This hook allows node modules to limit access to the node types they define.
  *
- *  @param $node
- *  The node on which the operation is to be performed, or, if it does not yet exist, the
- *  type of node to be created
+ * @param $node
+ *  The node on which the operation is to be performed, or, if it does not yet
+ *   exist, the type of node to be created
  *
- *  @param $op
+ * @param $op
  *  The operation to be performed
  *
- *  @param $account
- *  A user object representing the user for whom the operation is to be performed
+ * @param $account
+ *  A user object representing the user for whom the operation is to be
+ *   performed
  *
- *  @return
- *  If the permission for the specified operation is not set then return FALSE. If the
- *  permission is set then return NULL as this allows other modules to disable
- *  access.  The only exception is when the $op == 'create'.  We will always
- *  return TRUE if the permission is set.
+ * @return
+ *  If the permission for the specified operation is not set then return FALSE.
+ *   If the permission is set then return NULL as this allows other modules to
+ *   disable access.  The only exception is when the $op == 'create'.  We will
+ *   always return TRUE if the permission is set.
  *
  * @ingroup tripal_legacy_feature
  */
@@ -376,7 +391,7 @@ function tripal_feature_node_access($node, $op, $account) {
     $node_type = $node->type;
   }
 
-  if($node_type == 'chado_feature') {
+  if ($node_type == 'chado_feature') {
     if ($op == 'create') {
       if (!user_access('create chado_feature content', $account)) {
         return NODE_ACCESS_DENY;
@@ -420,10 +435,10 @@ function chado_feature_insert($node) {
   // we can skip adding the feature as it is already there, although
   // we do need to proceed with insertion into the chado/drupal linking table.
   if (!property_exists($node, 'feature_id')) {
-    $node->uniquename   = trim($node->uniquename);
-    $node->fname        = trim($node->fname);
+    $node->uniquename = trim($node->uniquename);
+    $node->fname = trim($node->fname);
     $node->feature_type = trim($node->feature_type);
-    $node->residues     = trim($node->residues);
+    $node->residues = trim($node->residues);
 
     // remove spaces, newlines from residues
     $residues = preg_replace("/[\n\r\s]/", "", $node->residues);
@@ -433,15 +448,15 @@ function chado_feature_insert($node) {
     }
 
     // get the feature type id
-    $values = array(
-        'cv_id' => array(
-            'name' => 'sequence'
-        ),
-        'name' => $node->feature_type
-    );
-    $type = chado_select_record('cvterm', array('cvterm_id'), $values);
+    $values = [
+      'cv_id' => [
+        'name' => 'sequence',
+      ],
+      'name' => $node->feature_type,
+    ];
+    $type = chado_select_record('cvterm', ['cvterm_id'], $values);
 
-    $values = array(
+    $values = [
       'organism_id' => $node->organism_id,
       'name' => $node->fname,
       'uniquename' => $node->uniquename,
@@ -449,13 +464,13 @@ function chado_feature_insert($node) {
       'seqlen' => drupal_strlen($residues),
       'is_obsolete' => $obsolete,
       'type_id' => $type[0]->cvterm_id,
-      'md5checksum' => md5($residues)
-    );
+      'md5checksum' => md5($residues),
+    ];
     $feature = chado_insert_record('feature', $values);
     if (!$feature) {
       drupal_set_message(t('Unable to add feature.'), 'warning');
       tripal_report_error('tripal_feature', TRIPAL_WARNING, 'Insert feature: Unable to create feature where values: %values',
-      array('%values' => print_r($values, TRUE)));
+        ['%values' => print_r($values, TRUE)]);
       return;
     }
     $feature_id = $feature['feature_id'];
@@ -464,27 +479,34 @@ function chado_feature_insert($node) {
     chado_feature_add_synonyms($node->synonyms, $feature_id);
 
     // * Properties Form *
-    $details = array(
-      'property_table' => 'featureprop',   // the name of the prop table
-      'base_table' => 'feature',           // the name of your chado base table
-      'foreignkey_name' => 'feature_id',   // the name of the key in your base table
-      'foreignkey_value' => $feature_id    // the value of the feature_id key
-    );
+    $details = [
+      'property_table' => 'featureprop',
+      // the name of the prop table
+      'base_table' => 'feature',
+      // the name of your chado base table
+      'foreignkey_name' => 'feature_id',
+      // the name of the key in your base table
+      'foreignkey_value' => $feature_id
+      // the value of the feature_id key
+    ];
     chado_update_node_form_properties($node, $details);
 
     // * Additional DBxrefs Form *
-    $details = array(
-      'linking_table' => 'feature_dbxref',   // the name of your _dbxref table
-      'foreignkey_name' => 'feature_id',     // the name of the key in your base table
-      'foreignkey_value' => $feature_id      // the value of the feature_id key
-    );
+    $details = [
+      'linking_table' => 'feature_dbxref',
+      // the name of your _dbxref table
+      'foreignkey_name' => 'feature_id',
+      // the name of the key in your base table
+      'foreignkey_value' => $feature_id
+      // the value of the feature_id key
+    ];
     chado_update_node_form_dbxrefs($node, $details);
 
     // * Relationships Form *
-    $details = array(
+    $details = [
       'relationship_table' => 'feature_relationship',
-      'foreignkey_value' => $feature_id
-    );
+      'foreignkey_value' => $feature_id,
+    ];
     chado_update_node_form_relationships($node, $details);
 
   }
@@ -511,10 +533,10 @@ function chado_feature_insert($node) {
  */
 function chado_feature_update($node) {
 
-  $node->uniquename   = trim($node->uniquename);
-  $node->fname        = trim($node->fname);
+  $node->uniquename = trim($node->uniquename);
+  $node->fname = trim($node->fname);
   $node->feature_type = trim($node->feature_type);
-  $node->residues     = trim($node->residues);
+  $node->residues = trim($node->residues);
 
 
   $residues = preg_replace("/[\n\r\s]/", "", $node->residues);
@@ -524,21 +546,21 @@ function chado_feature_update($node) {
   }
 
   // get the feature type id
-  $values = array(
-    'cv_id' => array(
-      'name' => 'sequence'
-    ),
-    'name' => $node->feature_type
-  );
-  $type = chado_select_record('cvterm', array('cvterm_id'), $values);
+  $values = [
+    'cv_id' => [
+      'name' => 'sequence',
+    ],
+    'name' => $node->feature_type,
+  ];
+  $type = chado_select_record('cvterm', ['cvterm_id'], $values);
 
-  $feature_id = chado_get_id_from_nid('feature', $node->nid) ;
+  $feature_id = chado_get_id_from_nid('feature', $node->nid);
 
   if (sizeof($type) > 0) {
-    $match = array(
+    $match = [
       'feature_id' => $feature_id,
-    );
-    $values = array(
+    ];
+    $values = [
       'organism_id' => $node->organism_id,
       'name' => $node->fname,
       'uniquename' => $node->uniquename,
@@ -546,44 +568,51 @@ function chado_feature_update($node) {
       'seqlen' => drupal_strlen($residues),
       'is_obsolete' => $obsolete,
       'type_id' => $type[0]->cvterm_id,
-      'md5checksum' => md5($residues)
-    );
-    $options = array('return_record' => TRUE);
+      'md5checksum' => md5($residues),
+    ];
+    $options = ['return_record' => TRUE];
     $status = chado_update_record('feature', $match, $values, $options);
 
     // add the genbank synonyms
     chado_feature_add_synonyms($node->synonyms, $feature_id);
 
     // * Properties Form *
-    $details = array(
-      'property_table' => 'featureprop',   // the name of the prop table
-      'base_table' => 'feature',           // the name of your chado base table
-      'foreignkey_name' => 'feature_id',   // the name of the key in your base table
-      'foreignkey_value' => $feature_id    // the value of the feature_id key
-    );
+    $details = [
+      'property_table' => 'featureprop',
+      // the name of the prop table
+      'base_table' => 'feature',
+      // the name of your chado base table
+      'foreignkey_name' => 'feature_id',
+      // the name of the key in your base table
+      'foreignkey_value' => $feature_id
+      // the value of the feature_id key
+    ];
     chado_update_node_form_properties($node, $details);
 
     // * Additional DBxrefs Form *
-    $details = array(
-      'linking_table' => 'feature_dbxref',   // the name of your _dbxref table
-      'foreignkey_name' => 'feature_id',     // the name of the key in your base table
-      'foreignkey_value' => $feature_id      // the value of the feature_id key
-    );
+    $details = [
+      'linking_table' => 'feature_dbxref',
+      // the name of your _dbxref table
+      'foreignkey_name' => 'feature_id',
+      // the name of the key in your base table
+      'foreignkey_value' => $feature_id
+      // the value of the feature_id key
+    ];
     chado_update_node_form_dbxrefs($node, $details);
 
     // * Relationships Form *
-    $details = array(
+    $details = [
       'relationship_table' => 'feature_relationship',
-      'foreignkey_value' => $feature_id
-    );
+      'foreignkey_value' => $feature_id,
+    ];
     chado_update_node_form_relationships($node, $details);
 
   }
   else {
     drupal_set_message(t('Unable to update feature.'), 'warning');
     tripal_report_error('tripal_feature', TRIPAL_WARNING,
-     'Update feature: Unable to update feature where values: %values',
-     array('%values' => print_r($values, TRUE))
+      'Update feature: Unable to update feature where values: %values',
+      ['%values' => print_r($values, TRUE)]
     );
   }
 
@@ -597,7 +626,7 @@ function chado_feature_update($node) {
  */
 function chado_feature_delete($node) {
 
-  $feature_id  = chado_get_id_from_nid('feature', $node->nid);
+  $feature_id = chado_get_id_from_nid('feature', $node->nid);
 
   // If we don't have a feature id for this node then this isn't a node of
   // type chado_library or the entry in the chado_library table was lost.
@@ -607,11 +636,11 @@ function chado_feature_delete($node) {
 
   // Remove the drupal content.
   $sql_del = "DELETE FROM {chado_feature} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
   $sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
   $sql_del = "DELETE FROM {node_revision} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
 
 
   // Remove data from feature tables of chado database.  This will
@@ -622,16 +651,16 @@ function chado_feature_delete($node) {
   // the chado_query function can handle this problem so we specificall delete
   // from that table to prevent the error. The same problem exists for the
   // frange.featuregroup table
-  $previous_db = chado_set_active('chado') ;
-  db_query("DELETE FROM frange.featuregroup WHERE subject_id = :feature_id", array(':feature_id' => $feature_id));
-  db_query("DELETE FROM frange.featuregroup WHERE object_id = :feature_id", array(':feature_id' => $feature_id));
-  db_query("DELETE FROM frange.featuregroup WHERE group_id = :feature_id", array(':feature_id' => $feature_id));
-  db_query("DELETE FROM frange.featuregroup WHERE srcfeature_id = :feature_id", array(':feature_id' => $feature_id));
+  $previous_db = chado_set_active('chado');
+  db_query("DELETE FROM frange.featuregroup WHERE subject_id = :feature_id", [':feature_id' => $feature_id]);
+  db_query("DELETE FROM frange.featuregroup WHERE object_id = :feature_id", [':feature_id' => $feature_id]);
+  db_query("DELETE FROM frange.featuregroup WHERE group_id = :feature_id", [':feature_id' => $feature_id]);
+  db_query("DELETE FROM frange.featuregroup WHERE srcfeature_id = :feature_id", [':feature_id' => $feature_id]);
   chado_set_active($previous_db);
 
-  chado_query("DELETE FROM {featureloc} WHERE feature_id = :feature_id", array(':feature_id' => $feature_id));
-  chado_query("DELETE FROM {featureloc} WHERE srcfeature_id = :feature_id", array(':feature_id' => $feature_id));
-  chado_query("DELETE FROM {feature} WHERE feature_id = :feature_id", array(':feature_id' => $feature_id));
+  chado_query("DELETE FROM {featureloc} WHERE feature_id = :feature_id", [':feature_id' => $feature_id]);
+  chado_query("DELETE FROM {featureloc} WHERE srcfeature_id = :feature_id", [':feature_id' => $feature_id]);
+  chado_query("DELETE FROM {feature} WHERE feature_id = :feature_id", [':feature_id' => $feature_id]);
 
   drupal_set_message(t("The feature and all associated data were removed"));
 }
@@ -651,14 +680,14 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
   // separate synomys by carriage returns
   $synonyms = preg_replace("/[\n\r]+/", " ", $synonyms);
   // split the synonyms into an array based on a space as the delimieter
-  $syn_array = array();
+  $syn_array = [];
   $syn_array = explode(" ", $synonyms);
 
 
   // remove any old synonyms
   $feature_syn_dsql = "DELETE FROM {feature_synonym} WHERE feature_id = :feature_id";
-  if (!chado_query($feature_syn_dsql, array(':feature_id' => $feature_id))) {
-    tripal_report_error('tripal_feature', TRIPAL_ERROR, "Could not remove synonyms from feature. ", array());
+  if (!chado_query($feature_syn_dsql, [':feature_id' => $feature_id])) {
+    tripal_report_error('tripal_feature', TRIPAL_ERROR, "Could not remove synonyms from feature. ", []);
     return;
   }
 
@@ -677,7 +706,7 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
     // if so then don't add it again. it messes up drupal if the insert fails.
     // It is possible for the accession number to be present and not the feature
     $synonym_sql = "SELECT synonym_id FROM {synonym} WHERE name = :name";
-    $synonym = chado_query($synonym_sql, array(':name' => $syn))->fetchObject();
+    $synonym = chado_query($synonym_sql, [':name' => $syn])->fetchObject();
     if (!$synonym) {
       $synonym_isql = "
         INSERT INTO {synonym} (name, synonym_sgml, type_id)
@@ -688,22 +717,29 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
            WHERE CV.name = 'feature_property' and CVT.name = 'synonym')
           )
       ";
-      if (!chado_query($synonym_isql, array(':name' => $syn, ':synonym_sgml' => $syn))) {
-        tripal_report_error('tripal_feature', "Could not add synonym. ", array(), TRIPAL_WARNING);
+      if (!chado_query($synonym_isql, [
+        ':name' => $syn,
+        ':synonym_sgml' => $syn,
+      ])) {
+        tripal_report_error('tripal_feature', "Could not add synonym. ", [], TRIPAL_WARNING);
         return;
       }
       // now get the synonym we just added
       $synonym_sql = "SELECT synonym_id FROM {synonym} WHERE name = :name";
-      $synonym = chado_query($synonym_sql, array(':name' => $syn))->fetchObject();
+      $synonym = chado_query($synonym_sql, [':name' => $syn])->fetchObject();
     }
 
     // now add in our new sysnonym
     $feature_syn_isql = "
       INSERT INTO {feature_synonym} (synonym_id,feature_id,pub_id)
       VALUES (:synonym_id, :feature_id, :pub_id)";
-    $args = array(':synonym_id' => $synonym->synonym_id, ':feature_id' => $feature_id, ':pub_id'=> 1);
+    $args = [
+      ':synonym_id' => $synonym->synonym_id,
+      ':feature_id' => $feature_id,
+      ':pub_id' => 1,
+    ];
     if (!chado_query($feature_syn_isql, $args)) {
-      tripal_report_error('tripal_feature', "Could not associate synonym with feature. ", array(), TRIPAL_WARNING);
+      tripal_report_error('tripal_feature', "Could not associate synonym with feature. ", [], TRIPAL_WARNING);
       return;
     }
   }
@@ -730,7 +766,7 @@ function chado_feature_load($nodes) {
     }
 
     // build the feature variable
-    $values = array('feature_id' => $feature_id);
+    $values = ['feature_id' => $feature_id];
     $feature = chado_generate_var('feature', $values);
     $nodes[$nid]->feature = $feature;
 
@@ -761,22 +797,27 @@ function tripal_feature_node_presave($node) {
       $name = '';
       $uname = '';
       $type = '';
-      $organism_id = null;
-      if(property_exists($node, 'uniquename')) {
+      $organism_id = NULL;
+      if (property_exists($node, 'uniquename')) {
         $organism_id = $node->organism_id;
-        $name        = $node->name;
-        $uname       = $node->uniquename;
-        $type        = $node->feature_type;
+        $name = $node->name;
+        $uname = $node->uniquename;
+        $type = $node->feature_type;
       }
-      else if (property_exists($node, 'feature')) {
-        $organism_id = $node->feature->organism_id;
-        $name        = $node->feature->name;
-        $uname       = $node->feature->uniquename;
-        $type        = $node->feature->cvtname;
+      else {
+        if (property_exists($node, 'feature')) {
+          $organism_id = $node->feature->organism_id;
+          $name = $node->feature->name;
+          $uname = $node->feature->uniquename;
+          $type = $node->feature->cvtname;
+        }
       }
 
-      $values = array('organism_id' => $organism_id);
-      $organism = chado_select_record('organism', array('genus', 'species'), $values);
+      $values = ['organism_id' => $organism_id];
+      $organism = chado_select_record('organism', [
+        'genus',
+        'species',
+      ], $values);
       $node->title = "$name, $uname ($type) " . $organism[0]->genus . ' ' . $organism[0]->species;
 
       break;
@@ -799,7 +840,7 @@ function tripal_feature_node_insert($node) {
       // we need to simulate one so that the right values are available for
       // the URL to be determined.
       $feature_id = chado_get_id_from_nid('feature', $node->nid);
-      $node->feature = chado_generate_var('feature', array('feature_id' => $feature_id));
+      $node->feature = chado_generate_var('feature', ['feature_id' => $feature_id]);
 
       // Now use the API to set the path.
       chado_set_node_url($node);
@@ -844,93 +885,93 @@ function tripal_feature_node_view($node, $view_mode, $langcode) {
     case 'chado_feature':
       // Show feature browser and counts
       if ($view_mode == 'full') {
-        $node->content['tripal_feature_alignments'] = array(
+        $node->content['tripal_feature_alignments'] = [
           '#theme' => 'tripal_feature_alignments',
           '#node' => $node,
-          '#tripal_toc_id'    => 'alignments',
+          '#tripal_toc_id' => 'alignments',
           '#tripal_toc_title' => 'Alignments',
-        );
-        $node->content['tripal_feature_analyses'] = array(
+        ];
+        $node->content['tripal_feature_analyses'] = [
           '#theme' => 'tripal_feature_analyses',
           '#node' => $node,
-          '#tripal_toc_id'    => 'analyses',
+          '#tripal_toc_id' => 'analyses',
           '#tripal_toc_title' => 'Analyses',
-        );
-        $node->content['tripal_feature_base'] = array(
+        ];
+        $node->content['tripal_feature_base'] = [
           '#theme' => 'tripal_feature_base',
           '#node' => $node,
-          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_id' => 'base',
           '#tripal_toc_title' => 'Overview',
           '#weight' => -100,
-        );
-        $node->content['tripal_feature_properties'] = array(
+        ];
+        $node->content['tripal_feature_properties'] = [
           '#theme' => 'tripal_feature_properties',
           '#node' => $node,
-          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_id' => 'properties',
           '#tripal_toc_title' => 'Properties',
-        );
-        $node->content['tripal_feature_publications'] = array(
+        ];
+        $node->content['tripal_feature_publications'] = [
           '#theme' => 'tripal_feature_publications',
           '#node' => $node,
-          '#tripal_toc_id'    => 'publications',
+          '#tripal_toc_id' => 'publications',
           '#tripal_toc_title' => 'Publications',
-        );
-        $node->content['tripal_feature_references'] = array(
+        ];
+        $node->content['tripal_feature_references'] = [
           '#theme' => 'tripal_feature_references',
           '#node' => $node,
-          '#tripal_toc_id'    => 'references',
+          '#tripal_toc_id' => 'references',
           '#tripal_toc_title' => 'Cross References',
-        );
-        $node->content['tripal_feature_relationships'] = array(
+        ];
+        $node->content['tripal_feature_relationships'] = [
           '#theme' => 'tripal_feature_relationships',
           '#node' => $node,
-          '#tripal_toc_id'    => 'relationships',
+          '#tripal_toc_id' => 'relationships',
           '#tripal_toc_title' => 'Relationships',
-        );
-        $node->content['tripal_feature_seqence'] = array(
+        ];
+        $node->content['tripal_feature_seqence'] = [
           '#theme' => 'tripal_feature_sequence',
           '#node' => $node,
-          '#tripal_toc_id'    => 'sequences',
+          '#tripal_toc_id' => 'sequences',
           '#tripal_toc_title' => 'Sequences',
-        );
-        $node->content['tripal_feature_synonyms'] = array(
+        ];
+        $node->content['tripal_feature_synonyms'] = [
           '#theme' => 'tripal_feature_synonyms',
           '#node' => $node,
-          '#tripal_toc_id'    => 'synonyms',
+          '#tripal_toc_id' => 'synonyms',
           '#tripal_toc_title' => 'Synonyms',
-        );
-        $node->content['tripal_feature_terms'] = array(
+        ];
+        $node->content['tripal_feature_terms'] = [
           '#theme' => 'tripal_feature_terms',
           '#node' => $node,
-          '#tripal_toc_id'    => 'terms',
+          '#tripal_toc_id' => 'terms',
           '#tripal_toc_title' => 'Annotated Terms',
-        );
+        ];
       }
       if ($view_mode == 'teaser') {
-        $node->content['tripal_feature_teaser'] = array(
+        $node->content['tripal_feature_teaser'] = [
           '#theme' => 'tripal_feature_teaser',
           '#node' => $node,
-        );
+        ];
       }
       break;
     case 'chado_organism':
       // Show feature browser and counts
       if ($view_mode == 'full') {
-        $node->content['tripal_organism_feature_counts'] = array(
+        $node->content['tripal_organism_feature_counts'] = [
           '#theme' => 'tripal_organism_feature_counts',
           '#node' => $node,
-          '#tripal_toc_id'    => 'feature_counts',
+          '#tripal_toc_id' => 'feature_counts',
           '#tripal_toc_title' => 'Feature Summary',
-        );
-        $node->content['tripal_organism_feature_browser'] = array(
+        ];
+        $node->content['tripal_organism_feature_browser'] = [
           '#theme' => 'tripal_organism_feature_browser',
           '#node' => $node,
-          '#tripal_toc_id'    => 'feature_browser',
+          '#tripal_toc_id' => 'feature_browser',
           '#tripal_toc_title' => 'Feature Browser',
-        );
+        ];
       }
       break;
-      // TODO: handle these node types. Should we also have a feature browser?
+    // TODO: handle these node types. Should we also have a feature browser?
     case 'chado_library':
       break;
     case 'chado_stock':

+ 44 - 45
legacy/tripal_feature/includes/tripal_feature.delete.inc

@@ -10,51 +10,51 @@
  * @ingroup tripal_legacy_feature
  */
 function tripal_feature_delete_form() {
-  $form['desc'] = array(
+  $form['desc'] = [
     '#markup' => t("Use one or more of the following fields to identify sets of features to be deleted."),
-  );
+  ];
 
-  $form['feature_names']= array(
+  $form['feature_names'] = [
     '#type' => 'textarea',
     '#title' => t('Feature Names'),
     '#description' => t('Please provide a list of feature names or unique names,
        separated by spaces or by new lines to be delete. If you specify feature names then
        all other options below will be ignored (except the unique checkbox).'),
-  );
-  $form['is_unique'] = array(
+  ];
+  $form['is_unique'] = [
     '#title' => t('Names are Unique Names'),
     '#type' => 'checkbox',
     '#description' => t('Select this checbox if the names listed in the feature
       names box above are the unique name of the feature rather than the human readable names.'),
-  );
-  $cv = tripal_get_cv(array('name' => 'sequence'));
-  $form['seq_type']= array(
-   '#title'       => t('Feature Type'),
-   '#type'        => 'textfield',
-   '#description' => t("Choose the feature type."),
-   '#autocomplete_path' => "admin/tripal/storage/chado/auto_name/cvterm/$cv->cv_id",
-  );
+  ];
+  $cv = tripal_get_cv(['name' => 'sequence']);
+  $form['seq_type'] = [
+    '#title' => t('Feature Type'),
+    '#type' => 'textfield',
+    '#description' => t("Choose the feature type."),
+    '#autocomplete_path' => "admin/tripal/storage/chado/auto_name/cvterm/$cv->cv_id",
+  ];
 
   $organisms = tripal_get_organism_select_options(FALSE);
-  $form['organism_id'] = array(
-   '#title'       => t('Organism'),
-   '#type'        => 'select',
-   '#description' => t("Choose the organism for which features will be deleted."),
-   '#options'     => $organisms,
-  );
+  $form['organism_id'] = [
+    '#title' => t('Organism'),
+    '#type' => 'select',
+    '#description' => t("Choose the organism for which features will be deleted."),
+    '#options' => $organisms,
+  ];
 
   $analyses = tripal_get_analysis_select_options(FALSE);
-  $form['analysis_id'] = array (
-    '#title'       => t('Analysis'),
-    '#type'        => t('select'),
+  $form['analysis_id'] = [
+    '#title' => t('Analysis'),
+    '#type' => t('select'),
     '#description' => t("Choose the analysis for which associated features will be deleted."),
-    '#options'     => $analyses,
-  );
+    '#options' => $analyses,
+  ];
 
-  $form['button'] = array(
+  $form['button'] = [
     '#type' => 'submit',
     '#value' => t('Delete Features'),
-  );
+  ];
   return $form;
 }
 
@@ -64,10 +64,10 @@ function tripal_feature_delete_form() {
  * @ingroup tripal_legacy_feature
  */
 function tripal_feature_delete_form_validate($form, &$form_state) {
-  $organism_id   = $form_state['values']['organism_id'];
-  $seq_type      = trim($form_state['values']['seq_type']);
-  $analysis_id   = $form_state['values']['analysis_id'];
-  $is_unique     = $form_state['values']['is_unique'];
+  $organism_id = $form_state['values']['organism_id'];
+  $seq_type = trim($form_state['values']['seq_type']);
+  $analysis_id = $form_state['values']['analysis_id'];
+  $is_unique = $form_state['values']['is_unique'];
   $feature_names = $form_state['values']['feature_names'];
 
   if (!$analysis_id and !$organism_id and !$seq_type and !$feature_names) {
@@ -83,13 +83,13 @@ function tripal_feature_delete_form_validate($form, &$form_state) {
 function tripal_feature_delete_form_submit($form, &$form_state) {
   global $user;
 
-  $organism_id   = $form_state['values']['organism_id'];
-  $seq_type      = trim($form_state['values']['seq_type']);
-  $analysis_id   = $form_state['values']['analysis_id'];
-  $is_unique     = $form_state['values']['is_unique'];
+  $organism_id = $form_state['values']['organism_id'];
+  $seq_type = trim($form_state['values']['seq_type']);
+  $analysis_id = $form_state['values']['analysis_id'];
+  $is_unique = $form_state['values']['is_unique'];
   $feature_names = $form_state['values']['feature_names'];
 
-  $args = array($organism_id, $analysis_id, $seq_type, $is_unique, $feature_names);
+  $args = [$organism_id, $analysis_id, $seq_type, $is_unique, $feature_names];
   tripal_add_job("Delete features", 'tripal_feature',
     'tripal_feature_delete_features', $args, $user->uid);
 }
@@ -104,8 +104,8 @@ function tripal_feature_delete_form_submit($form, &$form_state) {
  * @param $seq_type
  *   (Optional) The cvterm.name of the feature types to delete
  * @param $is_unique
- *   (Optional) A Boolean stating whether the names are unique (ie: feature.uniquename)
- *   or not (ie: feature.name)
+ *   (Optional) A Boolean stating whether the names are unique (ie:
+ *   feature.uniquename) or not (ie: feature.name)
  * @param $feature_names
  *   (Optional) A space separated list of the names of features to delete
  * @param $job
@@ -114,16 +114,16 @@ function tripal_feature_delete_form_submit($form, &$form_state) {
  * @ingroup tripal_legacy_feature
  */
 function tripal_feature_delete_features($organism_id, $analysis_id, $seq_type,
-  $is_unique, $feature_names, $job = NULL) {
+                                        $is_unique, $feature_names, $job = NULL) {
 
   global $user;
-  $match = array();
+  $match = [];
 
   // Begin the transaction.
   $transaction = db_transaction();
   print "\nNOTE: Deleting features is performed using a database transaction. \n" .
-      "If the load fails or is terminated prematurely then the entire set of \n" .
-      "deletions is rolled back and will not be found in the database\n\n";
+    "If the load fails or is terminated prematurely then the entire set of \n" .
+    "deletions is rolled back and will not be found in the database\n\n";
   try {
 
     // If feature names have been provided then handle those
@@ -138,7 +138,7 @@ function tripal_feature_delete_features($organism_id, $analysis_id, $seq_type,
       else {
         $match['name'] = $names;
       }
-      $num_deletes = chado_select_record('feature', array('count(*) as cnt'), $match);
+      $num_deletes = chado_select_record('feature', ['count(*) as cnt'], $match);
       print "Deleting " . $num_deletes[0]->cnt . " features\n";
 
       chado_delete_record('feature', $match);
@@ -146,7 +146,7 @@ function tripal_feature_delete_features($organism_id, $analysis_id, $seq_type,
     }
 
     // Now handle the combintation of all other inputs.
-    $args = array();
+    $args = [];
     $sql = "";
     $join = '';
     $where = '';
@@ -194,8 +194,7 @@ function tripal_feature_delete_features($organism_id, $analysis_id, $seq_type,
 
     print "Now removing orphaned feature pages\n";
     chado_cleanup_orphaned_nodes('feature');
-  }
-  catch (Exception $e) {
+  } catch (Exception $e) {
     print "\n"; // make sure we start errors on new line
     $transaction->rollback();
     print "FAILED: Rolling back database changes...\n";

+ 32 - 30
legacy/tripal_feature/theme/templates/tripal_feature_alignments.tpl.php

@@ -57,21 +57,23 @@
 $feature = $variables['node']->feature;
 $alignments = $feature->all_featurelocs;
 
-if(count($alignments) > 0){ ?>
-  <div class="tripal_feature-data-block-desc tripal-data-block-desc">The following features are aligned</div><?php
-  
+if (count($alignments) > 0) { ?>
+    <div class="tripal_feature-data-block-desc tripal-data-block-desc">The
+        following features are aligned
+    </div><?php
+
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Aligned Feature' ,'Feature Type', 'Alignment Location');
-  
+  $headers = ['Aligned Feature', 'Feature Type', 'Alignment Location'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
-  
-  foreach ($alignments as $alignment){
+  $rows = [];
+
+  foreach ($alignments as $alignment) {
     $feature_name = $alignment->name;
     if (property_exists($alignment, 'nid')) {
       $feature_name = l($feature_name, "node/" . $alignment->nid);
@@ -80,52 +82,52 @@ if(count($alignments) > 0){ ?>
     $strand = '.';
     if ($alignment->strand == -1) {
       $strand = '-';
-    } 
+    }
     elseif ($alignment->strand == 1) {
-       $strand = '+';
-    } 
+      $strand = '+';
+    }
     // if this is a match then make the other location 
-    if(property_exists($alignment, 'right_feature')){
+    if (property_exists($alignment, 'right_feature')) {
       $rstrand = '.';
       if ($alignment->right_strand == -1) {
         $rstrand = '-';
-      } 
+      }
       elseif ($alignment->right_strand == 1) {
         $rstrand = '+';
       }
-      $feature_loc = $feature->name .":". ($alignment->fmin + 1) . ".." . $alignment->fmax . " " . $strand; 
-      $feature_loc .= "<br>" . $alignment->name .":". ($alignment->right_fmin + 1) . ".." . $alignment->right_fmax . " " . $rstrand; 
+      $feature_loc = $feature->name . ":" . ($alignment->fmin + 1) . ".." . $alignment->fmax . " " . $strand;
+      $feature_loc .= "<br>" . $alignment->name . ":" . ($alignment->right_fmin + 1) . ".." . $alignment->right_fmax . " " . $rstrand;
     }
     else {
-      $feature_loc = $alignment->name .":". ($alignment->fmin + 1) . ".." . $alignment->fmax . " " . $strand; 
+      $feature_loc = $alignment->name . ":" . ($alignment->fmin + 1) . ".." . $alignment->fmax . " " . $strand;
     }
-    
-    $rows[] = array(
+
+    $rows[] = [
       $feature_name,
       $alignment->type,
-      $feature_loc
-    );
-  } 
-  
+      $feature_loc,
+    ];
+  }
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_feature-table-alignments',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table); 
+  print theme_table($table);
 }
 

+ 23 - 20
legacy/tripal_feature/theme/templates/tripal_feature_analyses.tpl.php

@@ -1,54 +1,57 @@
 <?php
 $feature = $variables['node']->feature;
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $feature = chado_expand_var($feature, 'table', 'analysisfeature', $options);
 $analyses = $feature->analysisfeature;
 
 // don't show this page if there are no analyses
 if (count($analyses) > 0) { ?>
-  <div class="tripal_feature-data-block-desc tripal-data-block-desc">This <?php print $feature->type_id->name ?> is derived from or has results from the following analyses</div> <?php
-  
+    <div class="tripal_feature-data-block-desc tripal-data-block-desc">
+        This <?php print $feature->type_id->name ?> is derived from or has
+        results from the following analyses
+    </div> <?php
+
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Analysis Name' ,'Date Performed');
-  
+  $headers = ['Analysis Name', 'Date Performed'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
-  
+  $rows = [];
+
   foreach ($analyses as $analysis) {
     $analysis_name = $analysis->analysis_id->name;
     if (property_exists($analysis->analysis_id, 'nid')) {
       $analysis_name = l($analysis_name, "node/" . $analysis->analysis_id->nid);
-    } 
-    $rows[] = array(
+    }
+    $rows[] = [
       $analysis_name,
-      preg_replace('/\d\d:\d\d:\d\d/', '',  $analysis->analysis_id->timeexecuted),
-    );
+      preg_replace('/\d\d:\d\d:\d\d/', '', $analysis->analysis_id->timeexecuted),
+    ];
   }
-   
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_feature-table-analyses',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table);  
+  print theme_table($table);
 } 
 

+ 15 - 9
legacy/tripal_feature/theme/templates/tripal_feature_bar_chart_type_organism_summary.tpl.php

@@ -9,20 +9,26 @@
  *
  * Most of the functionality is in the preprocess for this template and
  * the acompanying javascript file.
+ *
  * @see tripal_feature/theme/js/tripalFeature.adminChart.js
  * @see tripal_feature/theme/tripal_feature.theme.inc:tripal_feature_preprocess_tripal_feature_bar_chart_type_organism_summary()
  */
 ?>
 
 <div id="tripal-feature-admin-summary" class="tripal-admin-summary">
-  <div id="tripal-feature-admin-summary-chart" "tripal-admin-chart"></div>
-  <div id="tripal-feature-admin-summary-figure-desc" "tripal-admin-figure-desc">
-    <span class="figure-title">Feature Composition</span>:
-    This figure depicts the type and source organism of features in your Tripal
-    site. It is populated from the <em><?php print $chart_details['mviewTable']; ?></em>
-    materialized view which was last updated on <em><?php print $chart_details['mviewLastUpdate']; ?></em>.
-    <strong><em>To update this chart, <a href="<?php print $chart_details['mviewUrl'];?>">
-    submit a job to update the materialized view</a></em></strong>.
-  </div>
+    <div id="tripal-feature-admin-summary-chart"
+    "tripal-admin-chart">
+</div>
+<div id="tripal-feature-admin-summary-figure-desc" "tripal-admin-figure-desc">
+<span class="figure-title">Feature Composition</span>:
+This figure depicts the type and source organism of features in your Tripal
+site. It is populated from the
+<em><?php print $chart_details['mviewTable']; ?></em>
+materialized view which was last updated on
+<em><?php print $chart_details['mviewLastUpdate']; ?></em>.
+<strong><em>To update this chart, <a
+                href="<?php print $chart_details['mviewUrl']; ?>">
+            submit a job to update the materialized view</a></em></strong>.
+</div>
 </div>
 

+ 55 - 55
legacy/tripal_feature/theme/templates/tripal_feature_base.tpl.php

@@ -1,109 +1,109 @@
 <?php
-$feature  = $variables['node']->feature;  ?>
+$feature = $variables['node']->feature; ?>
+
+    <div class="tripal_feature-data-block-desc tripal-data-block-desc"></div> <?php
 
-<div class="tripal_feature-data-block-desc tripal-data-block-desc"></div> <?php
- 
 // the $headers array is an array of fields to use as the colum headers. 
 // additional documentation can be found here 
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
 // This table for the analysis has a vertical header (down the first column)
 // so we do not provide headers here, but specify them in the $rows array below.
-$headers = array();
+$headers = [];
 
 // the $rows array contains an array of rows where each row is an array
 // of values for each column of the table in that row.  Additional documentation
 // can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-$rows = array();
+$rows = [];
 
 // Name row
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Name',
     'header' => TRUE,
     'width' => '20%',
-  ),
-  $feature->name
-);
+  ],
+  $feature->name,
+];
 // Unique Name row
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Unique Name',
-    'header' => TRUE
-  ),
-  $feature->uniquename
-);
+    'header' => TRUE,
+  ],
+  $feature->uniquename,
+];
 // Type row
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Type',
-    'header' => TRUE
-  ),
-  $feature->type_id->name
-);
+    'header' => TRUE,
+  ],
+  $feature->type_id->name,
+];
 // Organism row
-$organism = $feature->organism_id->genus ." " . $feature->organism_id->species ." (" . $feature->organism_id->common_name .")";
+$organism = $feature->organism_id->genus . " " . $feature->organism_id->species . " (" . $feature->organism_id->common_name . ")";
 if (property_exists($feature->organism_id, 'nid')) {
-  $organism = l("<i>" . $feature->organism_id->genus . " " . $feature->organism_id->species . "</i> (" . $feature->organism_id->common_name .")", "node/".$feature->organism_id->nid, array('html' => TRUE));
-} 
-$rows[] = array(
-  array(
+  $organism = l("<i>" . $feature->organism_id->genus . " " . $feature->organism_id->species . "</i> (" . $feature->organism_id->common_name . ")", "node/" . $feature->organism_id->nid, ['html' => TRUE]);
+}
+$rows[] = [
+  [
     'data' => 'Organism',
     'header' => TRUE,
-  ),
-  $organism
-);
+  ],
+  $organism,
+];
 // Seqlen row
-if($feature->seqlen > 0) {
-  $rows[] = array(
-    array(
+if ($feature->seqlen > 0) {
+  $rows[] = [
+    [
       'data' => 'Sequence length',
       'header' => TRUE,
-    ),
-    $feature->seqlen
-  );
+    ],
+    $feature->seqlen,
+  ];
 }
 // allow site admins to see the feature ID
-if (user_access('view ids')) { 
+if (user_access('view ids')) {
   // Feature ID
-  $rows[] = array(
-    array(
+  $rows[] = [
+    [
       'data' => 'Feature ID',
       'header' => TRUE,
       'class' => 'tripal-site-admin-only-table-row',
-    ),
-    array(
+    ],
+    [
       'data' => $feature->feature_id,
       'class' => 'tripal-site-admin-only-table-row',
-    ),
-  );
+    ],
+  ];
 }
 // Is Obsolete Row
-if($feature->is_obsolete == TRUE){
-  $rows[] = array(
-    array(
+if ($feature->is_obsolete == TRUE) {
+  $rows[] = [
+    [
       'data' => '<div class="tripal_feature-obsolete">This feature is obsolete</div>',
-      'colspan' => 2
-    ),
-  );
+      'colspan' => 2,
+    ],
+  ];
 }
 
 // the $table array contains the headers and rows array as well as other
 // options for controlling the display of the table.  Additional
 // documentation can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-$table = array(
+$table = [
   'header' => $headers,
   'rows' => $rows,
-  'attributes' => array(
+  'attributes' => [
     'id' => 'tripal_feature-table-base',
-    'class' => 'tripal-data-table'
-  ),
+    'class' => 'tripal-data-table',
+  ],
   'sticky' => FALSE,
   'caption' => '',
-  'colgroups' => array(),
+  'colgroups' => [],
   'empty' => '',
-);
+];
 
 // once we have our table array structure defined, we call Drupal's theme_table()
 // function to generate the table.

+ 207 - 121
legacy/tripal_feature/theme/templates/tripal_feature_help.tpl.php

@@ -1,121 +1,207 @@
-  <h3>Module Description:</h3>
-  <p>The Tripal Feature module provides a new feature content type and interface for genomic features. </p>
-
-  <h3>Setup Instructions:</h3>
-  <p>After installation of the feature module.  The following tasks should be performed</p>
-  <ol>
-    <li><p><b>Set Permissions</b>: By default only the site administrator account has access to create, edit, delete
-   or administer features. Navigate to the <?php print l('permissions page', 'admin/user/permissions')?> and set the
-   permissions under the 'tripal_feature' section as appropriate for your site. For a simple setup, allow anonymous
-   users access to view content and create a special role for creating, editing and other administrative tasks.</p></li>
-
-   <li><p><b>Loading of Ontologies</b>:
-     Before loading genomic features you must also have several vocabularies loaded as well. Using the
-     <?php print l('OGO loader','admin/tripal/loaders/chado_vocabs/obo_loader')?> you should load the following
-     ontologies:</p>
-     <ul>
-        <li>Sequence Ontology</li>
-        <li>Gene Ontology (if loading GO terms for features)</li>
-     </ul>
-   </li>
-
-     <li><p><b>Create Organisms</b>:  Before adding feature data you must already have the
-     organisms loaded in the database.  See the
-     <?php print l('Tripal Organism Admin Page','admin/tripal/tripal_organism') ?> for
-     instructions for adding and Syncing organisms.</p></li>
-
-     <li><p><b>Create an Analysis</b>:  Tripal requires that feature data loaded using the Tripal loaders
-     be associated with an analyis.  This provides a grouping for the feature data and can be used
-     later to visualize data pipelines.  Before loading feature data through the FASTA or GFF loaders
-     you will need to <?php print l('create an analysis','node/add/chado-analysis') ?> for the data.</p></li>
-
-     <li><p><b>Create Database Cross References</b>:  If you would like to associate your feature data with an
-     external database, check to ensure that the <?php print l('database already exists','admin/tripal/tripal_db/edit_db') ?>.
-     If not you should <?php print l('add a new database record','admin/tripal/tripal_db/add_db') ?> before importing
-     feature data. Be sure to set the URL and URL prefix for the database if you would like accessions (e.g. GO terms, NCBI
-     accession) to link out to the external database.</p></li>
-
-     <li><p><b>Data Import</b>:  if you do not already have an existing Chado database with preloaded data
-     then you will want
-     to import data.  You can do so using the Chado perl scripts that come with the normal
-     <a href="http://gmod.org/wiki/Chado">distribution of Chado</a> or you can use
-     the <a href="<?php print url('admin/tripal/tripal_feature/fasta_loader') ?>">FASTA loader</a> and
-     <a href="<?php print url('admin/tripal/tripal_feature/gff3_load') ?>">GFF loader</a> provided here.  If you
-     created the Chado database using Tripal then you'll most likely want to use the Tripal loaders.  If your data
-     is not condusive for loading with these loaders and you can get your data into a tab-delimited format you can
-     use Tripals' bulk loader.
-     </p></li>
-
-     <li><p><b>Sync Features</b>:  After data is loaded you need to sync features.  This process is what
-     creates the pages for viewing online.  Not all features need be synced.  For instance, if you
-     have loaded whole genome sequence with fully defined gene models with several features to define
-     a gene and its products (e.g. gene, mRNA, CDS, 5\'UTR, 3\'UTR, etc) you probably only want to create
-     pages for genes or genes and mRNA.  You probably do not want a page for a 5\'UTR.
-     Using the <a href="<?php print url('admin/tripal/tripal_feature/configuration/sync') ?>">Feature Sync page</a>
-     you can sync (or create pages) for the desired feature types. </p></li>
-
-     <li><p><b>Set Feature URL</b>:  It is often convenient to have a simple URL for each feature page.
-     For example, http://www.mygenomesite.org/[feature], where [feature] is a unique identifier for a feature page.
-     With this, people can easily include links to feature pages of interest. Use the
-     <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Feature Configuration page</a>
-     to specify whether to use the feature name, unique name or internal ID as the [feature] portion of the
-     URL.  Select the one that will guarantee a unique identifier for feature pages.</p></li>
-
-  </ol>
-
-
-  <h3>Features of this Module:</h3>
-  <p>Aside from data loading and feature page setup (as described in the Setup section above),
-  The Tripal feature module also provides the following functionality</p>
-  <ul>
-    <li><p><b>Retrieve Sequences</b>: A tool to <?php print l('retrieve sequences','find/sequences') ?> is provided
-     which allows end-users to download sequences in FASTA format.  The site admin must first load sequence residues
-     as well as alignments.  The <?php  print l('organism_feature_count', 'admin/tripal/mviews') ?> and
-     <?php print l('analysis_organism', 'admin/tripal/mviews') ?> materialized
-     views must be populated before using this tool.  Those views should be re-populated
-     when new data is added.  If you use the <?php print l('jquery_update module', 'http://drupal.org/project/jquery_update') ?>
-     the tool may break.  You will need to update the jquery_update/replace/jquery.form.js file with <?php
-     print l('a more recent version','https://raw.github.com/malsup/form/master/jquery.form.js') ?>. </p></li>
-
-     <li><p><b>Generic Feature URL</b>:  As described in the setup instructions above, it is often convenient to have a
-     simple URL for each feature page. For example, http://www.mygenomesite.org/[feature], where [feature] is a
-     unique identifier for a feature page.  The
-     <?php print l('Feature Configuration page','admin/tripal/tripal_feature/configuration') ?> allows a
-     site admin to generate unique URLs for all feature.  The unique URL is necessary, however, sometimes
-     it is easier to allow for links to the feature name without knowing the unique URL.  This is possible
-     using the URL: http://[site url]/feature/[feature name], where [site url] is the URL for the site and
-     [feature name] is the name of the feature.  If the feature name is not unique then a page will be
-     presented listing all of the features with the same name and allow the user to choose which one to
-     view.  If the feature name is unique then the user will automatically be redirected to the
-     unique URL for the feature.</p></li>
-
-    <li><p><b>Feature Browser:</b>  The feature browser is a tabular list of features with links to their
-     feature pages which appears on the organism
-     page.  It was created to provide a mechanism to allow site visitors to quickly
-     accesss feature pages when they do not know what to search for.  For sites with large numbers of features, this
-     method for finding a specific pages is inadequate, but may still be included to aid new site
-     visitors.    This browser can be toggled on or off using the
-     <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Feature Configuration page</a></p></li>
-
-    <li><p><b>Feature Summary Report:</b>  The feature summary report is a pie chart that indicates the types and quantities
-    of feature types (Sequence Ontology terms) that are loaded in the database. It appears on the organism
-    page.  The summary can be toggled on or off using the
-    <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Feature Configuration page</a></p></li>
-
-    <li><p><b>Integration with Drupal Views</b>: <a href="http://drupal.org/project/views">Drupal Views</a> is
-    a powerful tool that allows the site administrator to create lists or basic searching forms of Chado content.
-    It provides a graphical interface within Drupal to allow the site admin to directly query the Chado database
-    and create custom lists without PHP programming or customization of Tripal source code.  Views can also
-    be created to filter content that has not yet been synced with Druapl in order to protect access to non
-    published data (only works if Chado was installed using Tripal).  You can see a list of available pre-existing
-    Views <a href="<?php print url('admin/build/views/') ?>">here</a>, as well as create your own. </p></li>
-
-    <li><p><b>Simple Search Tool</b>: A <?php print l('simple search tool','chado/features') ?> is provided for
-    finding features. This tool relies on Drupal Views.  <a href="http://drupal.org/project/views">Drupal Views</a>
-    which must be installed to see the search tool.  Look for it in the navigation menu under the item
-    "Search Data". </p></li>
-
-    <li><p><b>Delete Features</b>: You can  <a href="<?php print url('admin/tripal/tripal_feature/delete') ?>">bulk delete features</a>
-    by providing a list of feature names, or for a specific organism or for a specific feature type. Be sure you have
-    a full backup of your site before performing a bulk delete.</p></li>
-  </ul>
+<h3>Module Description:</h3>
+<p>The Tripal Feature module provides a new feature content type and interface
+    for genomic features. </p>
+
+<h3>Setup Instructions:</h3>
+<p>After installation of the feature module. The following tasks should be
+    performed</p>
+<ol>
+    <li><p><b>Set Permissions</b>: By default only the site administrator
+            account has access to create, edit, delete
+            or administer features. Navigate to
+            the <?php print l('permissions page', 'admin/user/permissions') ?>
+            and set the
+            permissions under the 'tripal_feature' section as appropriate for
+            your site. For a simple setup, allow anonymous
+            users access to view content and create a special role for creating,
+            editing and other administrative tasks.</p></li>
+
+    <li><p><b>Loading of Ontologies</b>:
+            Before loading genomic features you must also have several
+            vocabularies loaded as well. Using the
+        <?php print l('OGO loader', 'admin/tripal/loaders/chado_vocabs/obo_loader') ?>
+            you should load the following
+            ontologies:</p>
+        <ul>
+            <li>Sequence Ontology</li>
+            <li>Gene Ontology (if loading GO terms for features)</li>
+        </ul>
+    </li>
+
+    <li><p><b>Create Organisms</b>: Before adding feature data you must already
+            have the
+            organisms loaded in the database. See the
+        <?php print l('Tripal Organism Admin Page', 'admin/tripal/tripal_organism') ?>
+            for
+            instructions for adding and Syncing organisms.</p></li>
+
+    <li><p><b>Create an Analysis</b>: Tripal requires that feature data loaded
+            using the Tripal loaders
+            be associated with an analyis. This provides a grouping for the
+            feature data and can be used
+            later to visualize data pipelines. Before loading feature data
+            through the FASTA or GFF loaders
+            you will need
+            to <?php print l('create an analysis', 'node/add/chado-analysis') ?>
+            for the data.</p></li>
+
+    <li><p><b>Create Database Cross References</b>: If you would like to
+            associate your feature data with an
+            external database, check to ensure that
+            the <?php print l('database already exists', 'admin/tripal/tripal_db/edit_db') ?>
+            .
+            If not you
+            should <?php print l('add a new database record', 'admin/tripal/tripal_db/add_db') ?>
+            before importing
+            feature data. Be sure to set the URL and URL prefix for the database
+            if you would like accessions (e.g. GO terms, NCBI
+            accession) to link out to the external database.</p></li>
+
+    <li><p><b>Data Import</b>: if you do not already have an existing Chado
+            database with preloaded data
+            then you will want
+            to import data. You can do so using the Chado perl scripts that come
+            with the normal
+            <a href="http://gmod.org/wiki/Chado">distribution of Chado</a> or
+            you can use
+            the
+            <a href="<?php print url('admin/tripal/tripal_feature/fasta_loader') ?>">FASTA
+                loader</a> and
+            <a href="<?php print url('admin/tripal/tripal_feature/gff3_load') ?>">GFF
+                loader</a> provided here. If you
+            created the Chado database using Tripal then you'll most likely want
+            to use the Tripal loaders. If your data
+            is not condusive for loading with these loaders and you can get your
+            data into a tab-delimited format you can
+            use Tripals' bulk loader.
+        </p></li>
+
+    <li><p><b>Sync Features</b>: After data is loaded you need to sync features.
+            This process is what
+            creates the pages for viewing online. Not all features need be
+            synced. For instance, if you
+            have loaded whole genome sequence with fully defined gene models
+            with several features to define
+            a gene and its products (e.g. gene, mRNA, CDS, 5\'UTR, 3\'UTR, etc)
+            you probably only want to create
+            pages for genes or genes and mRNA. You probably do not want a page
+            for a 5\'UTR.
+            Using the <a
+                    href="<?php print url('admin/tripal/tripal_feature/configuration/sync') ?>">Feature
+                Sync page</a>
+            you can sync (or create pages) for the desired feature types. </p>
+    </li>
+
+    <li><p><b>Set Feature URL</b>: It is often convenient to have a simple URL
+            for each feature page.
+            For example, http://www.mygenomesite.org/[feature], where [feature]
+            is a unique identifier for a feature page.
+            With this, people can easily include links to feature pages of
+            interest. Use the
+            <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Feature
+                Configuration page</a>
+            to specify whether to use the feature name, unique name or internal
+            ID as the [feature] portion of the
+            URL. Select the one that will guarantee a unique identifier for
+            feature pages.</p></li>
+
+</ol>
+
+
+<h3>Features of this Module:</h3>
+<p>Aside from data loading and feature page setup (as described in the Setup
+    section above),
+    The Tripal feature module also provides the following functionality</p>
+<ul>
+    <li><p><b>Retrieve Sequences</b>: A tool
+            to <?php print l('retrieve sequences', 'find/sequences') ?> is
+            provided
+            which allows end-users to download sequences in FASTA format. The
+            site admin must first load sequence residues
+            as well as alignments.
+            The <?php print l('organism_feature_count', 'admin/tripal/mviews') ?>
+            and
+        <?php print l('analysis_organism', 'admin/tripal/mviews') ?>
+            materialized
+            views must be populated before using this tool. Those views should
+            be re-populated
+            when new data is added. If you use
+            the <?php print l('jquery_update module', 'http://drupal.org/project/jquery_update') ?>
+            the tool may break. You will need to update the
+            jquery_update/replace/jquery.form.js file with <?php
+        print l('a more recent version', 'https://raw.github.com/malsup/form/master/jquery.form.js') ?>
+            . </p></li>
+
+    <li><p><b>Generic Feature URL</b>: As described in the setup instructions
+            above, it is often convenient to have a
+            simple URL for each feature page. For example,
+            http://www.mygenomesite.org/[feature], where [feature] is a
+            unique identifier for a feature page. The
+        <?php print l('Feature Configuration page', 'admin/tripal/tripal_feature/configuration') ?>
+            allows a
+            site admin to generate unique URLs for all feature. The unique URL
+            is necessary, however, sometimes
+            it is easier to allow for links to the feature name without knowing
+            the unique URL. This is possible
+            using the URL: http://[site url]/feature/[feature name], where [site
+            url] is the URL for the site and
+            [feature name] is the name of the feature. If the feature name is
+            not unique then a page will be
+            presented listing all of the features with the same name and allow
+            the user to choose which one to
+            view. If the feature name is unique then the user will automatically
+            be redirected to the
+            unique URL for the feature.</p></li>
+
+    <li><p><b>Feature Browser:</b> The feature browser is a tabular list of
+            features with links to their
+            feature pages which appears on the organism
+            page. It was created to provide a mechanism to allow site visitors
+            to quickly
+            accesss feature pages when they do not know what to search for. For
+            sites with large numbers of features, this
+            method for finding a specific pages is inadequate, but may still be
+            included to aid new site
+            visitors. This browser can be toggled on or off using the
+            <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Feature
+                Configuration page</a></p></li>
+
+    <li><p><b>Feature Summary Report:</b> The feature summary report is a pie
+            chart that indicates the types and quantities
+            of feature types (Sequence Ontology terms) that are loaded in the
+            database. It appears on the organism
+            page. The summary can be toggled on or off using the
+            <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Feature
+                Configuration page</a></p></li>
+
+    <li><p><b>Integration with Drupal Views</b>: <a
+                    href="http://drupal.org/project/views">Drupal Views</a> is
+            a powerful tool that allows the site administrator to create lists
+            or basic searching forms of Chado content.
+            It provides a graphical interface within Drupal to allow the site
+            admin to directly query the Chado database
+            and create custom lists without PHP programming or customization of
+            Tripal source code. Views can also
+            be created to filter content that has not yet been synced with
+            Druapl in order to protect access to non
+            published data (only works if Chado was installed using Tripal). You
+            can see a list of available pre-existing
+            Views <a href="<?php print url('admin/build/views/') ?>">here</a>,
+            as well as create your own. </p></li>
+
+    <li><p><b>Simple Search Tool</b>:
+            A <?php print l('simple search tool', 'chado/features') ?> is
+            provided for
+            finding features. This tool relies on Drupal Views. <a
+                    href="http://drupal.org/project/views">Drupal Views</a>
+            which must be installed to see the search tool. Look for it in the
+            navigation menu under the item
+            "Search Data". </p></li>
+
+    <li><p><b>Delete Features</b>: You can <a
+                    href="<?php print url('admin/tripal/tripal_feature/delete') ?>">bulk
+                delete features</a>
+            by providing a list of feature names, or for a specific organism or
+            for a specific feature type. Be sure you have
+            a full backup of your site before performing a bulk delete.</p></li>
+</ul>

+ 24 - 24
legacy/tripal_feature/theme/templates/tripal_feature_properties.tpl.php

@@ -1,52 +1,52 @@
 <?php
 
 $feature = $variables['node']->feature;
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $feature = chado_expand_var($feature, 'table', 'featureprop', $options);
 $properties = $feature->featureprop;
 
-if(count($properties) > 0){ 
-  
+if (count($properties) > 0) {
+
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Property Name', 'Value');
-  
+  $headers = ['Property Name', 'Value'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
-  
-  foreach ($properties as $property){
-    $property = chado_expand_var($property,'field','featureprop.value');
-    $rows[] = array(
-      array(
+  $rows = [];
+
+  foreach ($properties as $property) {
+    $property = chado_expand_var($property, 'field', 'featureprop.value');
+    $rows[] = [
+      [
         'data' => ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-        'width' => '20%'
-      ),
-      urldecode($property->value)
-    );
+        'width' => '20%',
+      ],
+      urldecode($property->value),
+    ];
   }
-   
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_feature-table-properties',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table); 
+  print theme_table($table);
 }

+ 40 - 35
legacy/tripal_feature/theme/templates/tripal_feature_publications.tpl.php

@@ -2,82 +2,87 @@
 $feature = $variables['node']->feature;
 
 // expand feature to include pubs 
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $feature = chado_expand_var($feature, 'table', 'feature_pub', $options);
-$feature_pubs = $feature->feature_pub; 
+$feature_pubs = $feature->feature_pub;
 
 
 if (count($feature_pubs) > 0) { ?>
-  <div class="tripal_feature_pub-data-block-desc tripal-data-block-desc"></div> <?php 
+    <div class="tripal_feature_pub-data-block-desc tripal-data-block-desc"></div> <?php
 
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Year', 'Publication');
-  
+  $headers = ['Year', 'Publication'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
-  
+  $rows = [];
+
   foreach ($feature_pubs as $feature_pub) {
     $pub = $feature_pub->pub_id;
     $pub = chado_expand_var($pub, 'field', 'pub.title');
     $citation = $pub->title;  // use the title as the default citation
-    
+
     // get the citation for this pub if it exists
-    $values = array(
-      'pub_id' => $pub->pub_id, 
-      'type_id' => array(
+    $values = [
+      'pub_id' => $pub->pub_id,
+      'type_id' => [
         'name' => 'Citation',
-      ),
-    );
-    $options = array('return_array' => 1);
-    $citation_prop = chado_generate_var('pubprop', $values, $options); 
+      ],
+    ];
+    $options = ['return_array' => 1];
+    $citation_prop = chado_generate_var('pubprop', $values, $options);
     if (count($citation_prop) == 1) {
       $citation_prop = chado_expand_var($citation_prop, 'field', 'pubprop.value');
       $citation = $citation_prop[0]->value;
     }
-    
+
     // if the publication is synced then link to it
     if ($pub->nid) {
       // replace the title with a link
-      $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
-      $patterns = array(
-        '/(\()/', '/(\))/',
-        '/(\])/', '/(\[)/',
-        '/(\{)/', '/(\})/',
-        '/(\+)/', '/(\.)/', '/(\?)/',
-      );
+      $link = l($pub->title, 'node/' . $pub->nid, ['attributes' => ['target' => '_blank']]);
+      $patterns = [
+        '/(\()/',
+        '/(\))/',
+        '/(\])/',
+        '/(\[)/',
+        '/(\{)/',
+        '/(\})/',
+        '/(\+)/',
+        '/(\.)/',
+        '/(\?)/',
+      ];
       $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
       $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
     }
-    
-    $rows[] = array(
+
+    $rows[] = [
       $pub->pyear,
       $citation,
-    );
+    ];
   }
-  
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_feature-table-publications',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table); 
+  print theme_table($table);
 }

+ 40 - 39
legacy/tripal_feature/theme/templates/tripal_feature_references.tpl.php

@@ -1,6 +1,6 @@
 <?php
 $feature = $variables['node']->feature;
-$references = array();
+$references = [];
 
 // First, get the dbxref record from feature record itself if one exists
 if ($feature->dbxref_id) {
@@ -9,12 +9,12 @@ if ($feature->dbxref_id) {
 }
 
 // Second, expand the feature object to include the records from the feature_dbxref table
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $feature = chado_expand_var($feature, 'table', 'feature_dbxref', $options);
 $feature_dbxrefs = $feature->feature_dbxref;
-if (count($feature_dbxrefs) > 0 ) {
-  foreach ($feature_dbxrefs as $feature_dbxref) {    
-    if($feature_dbxref->dbxref_id->db_id->name == 'GFF_source'){
+if (count($feature_dbxrefs) > 0) {
+  foreach ($feature_dbxrefs as $feature_dbxref) {
+    if ($feature_dbxref->dbxref_id->db_id->name == 'GFF_source') {
       // check to see if the reference 'GFF_source' is there.  This reference is
       // used to if the Chado Perl GFF loader was used to load the features   
     }
@@ -25,63 +25,64 @@ if (count($feature_dbxrefs) > 0 ) {
 }
 
 
-if(count($references) > 0){ ?>
-  <div class="tripal_feature-data-block-desc tripal-data-block-desc">External references for this <?php print $feature->type_id->name ?></div><?php
-   
+if (count($references) > 0) { ?>
+    <div class="tripal_feature-data-block-desc tripal-data-block-desc">External
+    references for this <?php print $feature->type_id->name ?></div><?php
+
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Database', 'Accession');
-  
+  $headers = ['Database', 'Accession'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
+  $rows = [];
+
+  foreach ($references as $dbxref) {
 
-  foreach ($references as $dbxref){
-  
     // skip the GFF_source entry as this is just needed for the GBrowse chado adapter 
-    if ($dbxref->db_id->name == 'GFF_source'){
-       continue;  
-    } 
-    $dbname = $dbxref->db_id->name; 
-    if ($dbxref->db_id->url) { 
-      $dbname = l($dbname, $dbxref->db_id->url, array('attributes' => array('target' => '_blank')));
-    } 
-    
-    $accession = $dbxref->accession; 
-    if ($dbxref->db_id->urlprefix) { 
-      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
-    } 
+    if ($dbxref->db_id->name == 'GFF_source') {
+      continue;
+    }
+    $dbname = $dbxref->db_id->name;
+    if ($dbxref->db_id->url) {
+      $dbname = l($dbname, $dbxref->db_id->url, ['attributes' => ['target' => '_blank']]);
+    }
+
+    $accession = $dbxref->accession;
+    if ($dbxref->db_id->urlprefix) {
+      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, ['attributes' => ['target' => '_blank']]);
+    }
     if (property_exists($dbxref, 'is_primary')) {
       $accession .= " <i>(primary cross-reference)</i>";
     }
-    $rows[] = array(
+    $rows[] = [
       $dbname,
-      $accession
-    );
-  } 
-  
+      $accession,
+    ];
+  }
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_feature-table-references',
-      'class' => 'tripal-data-table' 
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table); 
-}?>
+  print theme_table($table);
+} ?>
 

+ 124 - 107
legacy/tripal_feature/theme/templates/tripal_feature_relationships.tpl.php

@@ -23,11 +23,11 @@ $object_rels = $all_relationships['object'];
 $subject_rels = $all_relationships['subject'];
 
 if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
-  <div class="tripal_feature-data-block-desc tripal-data-block-desc"></div> <?php
+    <div class="tripal_feature-data-block-desc tripal-data-block-desc"></div> <?php
 
   // first add in the subject relationships.
-  foreach ($subject_rels as $rel_type => $rels){
-    foreach ($rels as $obj_type => $objects){
+  foreach ($subject_rels as $rel_type => $rels) {
+    foreach ($rels as $obj_type => $objects) {
 
       // Make the verb in the sentence make sense in English.
       switch ($rel_type) {
@@ -62,66 +62,74 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
           $verb = 'is';
       } ?>
 
-      <p>This <?php print $feature->type_id->name;?> <?php print $verb ?> <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> feature(s): <?php
+        <p>
+            This <?php print $feature->type_id->name; ?> <?php print $verb ?> <?php print $rel_type ?>
+            the following <b><?php print $obj_type ?></b> feature(s): <?php
 
-      // the $headers array is an array of fields to use as the colum headers.
-      // additional documentation can be found here
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $headers = array('Feature Name' ,'Unique Name', 'Species', 'Type');
+          // the $headers array is an array of fields to use as the colum headers.
+          // additional documentation can be found here
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $headers = ['Feature Name', 'Unique Name', 'Species', 'Type'];
 
-      // the $rows array contains an array of rows where each row is an array
-      // of values for each column of the table in that row.  Additional documentation
-      // can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $rows = array();
+          // the $rows array contains an array of rows where each row is an array
+          // of values for each column of the table in that row.  Additional documentation
+          // can be found here:
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $rows = [];
 
-      foreach ($objects as $object){
-        // link the feature to it's node
-        $feature_name = $object->record->object_id->name;
-        if (property_exists($object->record, 'nid')) {
-          $feature_name = l($feature_name, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
-        }
-        // link the organism to it's node
-        $organism = $object->record->object_id->organism_id;
-        $organism_name = $organism->genus ." " . $organism->species;
-        if (property_exists($organism, 'nid')) {
-          $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
-        }
-        $rows[] = array(
-          array('data' => $feature_name, 'width' => '30%'),
-          array('data' => $object->record->object_id->uniquename, 'width' => '30%'),
-          array('data' => $organism_name, 'width' => '30%'),
-          array('data' => $object->record->object_id->type_id->name, 'width' => '10%'),
-        );
-       }
-       // the $table array contains the headers and rows array as well as other
-       // options for controlling the display of the table.  Additional
-       // documentation can be found here:
-       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-       $table = array(
-         'header' => $headers,
-         'rows' => $rows,
-         'attributes' => array(
-           'id' => 'tripal_feature-table-relationship-object',
-           'class' => 'tripal-data-table'
-         ),
-         'sticky' => FALSE,
-         'caption' => '',
-         'colgroups' => array(),
-         'empty' => '',
-       );
+          foreach ($objects as $object) {
+            // link the feature to it's node
+            $feature_name = $object->record->object_id->name;
+            if (property_exists($object->record, 'nid')) {
+              $feature_name = l($feature_name, "node/" . $object->record->nid, ['attributes' => ['target' => "_blank"]]);
+            }
+            // link the organism to it's node
+            $organism = $object->record->object_id->organism_id;
+            $organism_name = $organism->genus . " " . $organism->species;
+            if (property_exists($organism, 'nid')) {
+              $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, ['html' => TRUE]);
+            }
+            $rows[] = [
+              ['data' => $feature_name, 'width' => '30%'],
+              [
+                'data' => $object->record->object_id->uniquename,
+                'width' => '30%',
+              ],
+              ['data' => $organism_name, 'width' => '30%'],
+              [
+                'data' => $object->record->object_id->type_id->name,
+                'width' => '10%',
+              ],
+            ];
+          }
+          // the $table array contains the headers and rows array as well as other
+          // options for controlling the display of the table.  Additional
+          // documentation can be found here:
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $table = [
+            'header' => $headers,
+            'rows' => $rows,
+            'attributes' => [
+              'id' => 'tripal_feature-table-relationship-object',
+              'class' => 'tripal-data-table',
+            ],
+            'sticky' => FALSE,
+            'caption' => '',
+            'colgroups' => [],
+            'empty' => '',
+          ];
 
-       // once we have our table array structure defined, we call Drupal's theme_table()
-       // function to generate the table.
-       print theme_table($table); ?>
-       </p>
-       <br><?php
-     }
+          // once we have our table array structure defined, we call Drupal's theme_table()
+          // function to generate the table.
+          print theme_table($table); ?>
+        </p>
+        <br><?php
+    }
   }
 
   // second add in the object relationships.
-  foreach ($object_rels as $rel_type => $rels){
-    foreach ($rels as $subject_type => $subjects){
+  foreach ($object_rels as $rel_type => $rels) {
+    foreach ($rels as $subject_type => $subjects) {
 
       // Make the verb in the sentence make sense in English.
       switch ($rel_type) {
@@ -155,59 +163,68 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
         default:
           $verb = 'are';
       } ?>
-      <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> feature(s) <?php print $verb ?> <?php print $rel_type ?> this <?php print $feature->type_id->name;?>: <?php
-      // the $headers array is an array of fields to use as the colum headers.
-      // additional documentation can be found here
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $headers = array('Feature Name' ,'Unique Name', 'Species', 'Type');
+        <p>The following
+            <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b>
+            feature(s) <?php print $verb ?> <?php print $rel_type ?>
+            this <?php print $feature->type_id->name; ?>: <?php
+          // the $headers array is an array of fields to use as the colum headers.
+          // additional documentation can be found here
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $headers = ['Feature Name', 'Unique Name', 'Species', 'Type'];
 
-      // the $rows array contains an array of rows where each row is an array
-      // of values for each column of the table in that row.  Additional documentation
-      // can be found here:
-      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-      $rows = array();
+          // the $rows array contains an array of rows where each row is an array
+          // of values for each column of the table in that row.  Additional documentation
+          // can be found here:
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $rows = [];
 
-      foreach ($subjects as $subject){
-        // link the feature to it's node
-        $feature_name = $subject->record->subject_id->name;
-        if (property_exists($subject->record, 'nid')) {
-          $feature_name = l($feature_name, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
-        }
-        // link the organism to it's node
-        $organism = $subject->record->subject_id->organism_id;
-        $organism_name = $organism->genus ." " . $organism->species;
-        if (property_exists($organism, 'nid')) {
-          $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
-        }
-        $rows[] = array(
-          array('data' => $feature_name, 'width' => '30%'),
-          array('data' =>$subject->record->subject_id->uniquename, 'width' => '30%'),
-          array('data' =>$organism_name, 'width' => '30%'),
-          array('data' =>$subject->record->subject_id->type_id->name, 'width' => '10%'),
-        );
-       }
-       // the $table array contains the headers and rows array as well as other
-       // options for controlling the display of the table.  Additional
-       // documentation can be found here:
-       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-       $table = array(
-         'header' => $headers,
-         'rows' => $rows,
-         'attributes' => array(
-           'id' => 'tripal_feature-table-relationship-subject',
-           'class' => 'tripal-data-table'
-         ),
-         'sticky' => FALSE,
-         'caption' => '',
-         'colgroups' => array(),
-         'empty' => '',
-       );
+          foreach ($subjects as $subject) {
+            // link the feature to it's node
+            $feature_name = $subject->record->subject_id->name;
+            if (property_exists($subject->record, 'nid')) {
+              $feature_name = l($feature_name, "node/" . $subject->record->nid, ['attributes' => ['target' => "_blank"]]);
+            }
+            // link the organism to it's node
+            $organism = $subject->record->subject_id->organism_id;
+            $organism_name = $organism->genus . " " . $organism->species;
+            if (property_exists($organism, 'nid')) {
+              $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, ['html' => TRUE]);
+            }
+            $rows[] = [
+              ['data' => $feature_name, 'width' => '30%'],
+              [
+                'data' => $subject->record->subject_id->uniquename,
+                'width' => '30%',
+              ],
+              ['data' => $organism_name, 'width' => '30%'],
+              [
+                'data' => $subject->record->subject_id->type_id->name,
+                'width' => '10%',
+              ],
+            ];
+          }
+          // the $table array contains the headers and rows array as well as other
+          // options for controlling the display of the table.  Additional
+          // documentation can be found here:
+          // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+          $table = [
+            'header' => $headers,
+            'rows' => $rows,
+            'attributes' => [
+              'id' => 'tripal_feature-table-relationship-subject',
+              'class' => 'tripal-data-table',
+            ],
+            'sticky' => FALSE,
+            'caption' => '',
+            'colgroups' => [],
+            'empty' => '',
+          ];
 
-       // once we have our table array structure defined, we call Drupal's theme_table()
-       // function to generate the table.
-       print theme_table($table); ?>
-       </p>
-       <br><?php
-     }
+          // once we have our table array structure defined, we call Drupal's theme_table()
+          // function to generate the table.
+          print theme_table($table); ?>
+        </p>
+        <br><?php
+    }
   }
 }

+ 38 - 32
legacy/tripal_feature/theme/templates/tripal_feature_sequence.tpl.php

@@ -17,12 +17,12 @@ $num_bases = 50;
 // we don't want to get the sequence for traditionally large types. They are
 // too big,  bog down the web browser, take longer to load and it's not
 // reasonable to print them on a page.
-$residues ='';
-if(strcmp($feature->type_id->name,'scaffold') !=0 and
-   strcmp($feature->type_id->name,'chromosome') !=0 and
-   strcmp($feature->type_id->name,'supercontig') !=0 and
-   strcmp($feature->type_id->name,'pseudomolecule') !=0) {
-  $feature = chado_expand_var($feature,'field','feature.residues');
+$residues = '';
+if (strcmp($feature->type_id->name, 'scaffold') != 0 and
+  strcmp($feature->type_id->name, 'chromosome') != 0 and
+  strcmp($feature->type_id->name, 'supercontig') != 0 and
+  strcmp($feature->type_id->name, 'pseudomolecule') != 0) {
+  $feature = chado_expand_var($feature, 'field', 'feature.residues');
   $residues = $feature->residues;
 }
 
@@ -33,7 +33,7 @@ $featureloc_sequences = $feature->featureloc_sequences;
 if ($residues or count($featureloc_sequences) > 0) {
 
   $sequences_html = '';  // a variable for holding all sequences HTML text
-  $list_items = array(); // a list to be used for theming of content on this page
+  $list_items = []; // a list to be used for theming of content on this page
 
   // ADD IN RESIDUES FOR THIS FEATURE
   // add in the residues if they are present
@@ -61,9 +61,9 @@ if ($residues or count($featureloc_sequences) > 0) {
   $object_rels = $all_relationships['object'];
   $has_coding_seq = 0;
   $coding_seq = '';
-  foreach ($object_rels as $rel_type => $rels){
-    foreach ($rels as $subject_type => $subjects){
-      foreach ($subjects as $subject){
+  foreach ($object_rels as $rel_type => $rels) {
+    foreach ($rels as $subject_type => $subjects) {
+      foreach ($subjects as $subject) {
 
         // add in protein sequence if it has residues
         if ($rel_type == 'derives from' and $subject_type == 'polypeptide') {
@@ -131,8 +131,8 @@ if ($residues or count($featureloc_sequences) > 0) {
    *
    *   $feature->featureloc_sequences
    */
-  if(count($featureloc_sequences) > 0){
-    foreach($featureloc_sequences as $src => $attrs){
+  if (count($featureloc_sequences) > 0) {
+    foreach ($featureloc_sequences as $src => $attrs) {
       // the $attrs array has the following keys
       //   * id:  a unique identifier combining the feature id with the cvterm id
       //   * type: the type of sequence (e.g. mRNA, etc)
@@ -140,10 +140,10 @@ if ($residues or count($featureloc_sequences) > 0) {
       //   * defline: the definition line
       //   * formatted_seq: the formatted sequences
       //   * featureloc:  the feature object aligned to
-      $list_items[] = '<a href="#' . $attrs['id'] . '">'. $feature->type_id->name . ' from alignment at  ' . $attrs['location'] . "</a>";
+      $list_items[] = '<a href="#' . $attrs['id'] . '">' . $feature->type_id->name . ' from alignment at  ' . $attrs['location'] . "</a>";
       $sequences_html .= '<a name="' . $attrs['id'] . '"></a>';
       $sequences_html .= '<div id="' . $attrs['id'] . '" class="tripal_feature-sequence-item">';
-      $sequences_html .= '<p><b>'. $feature->type_id->name . ' from alignment at  ' . $attrs['location'] .'</b></p>';
+      $sequences_html .= '<p><b>' . $feature->type_id->name . ' from alignment at  ' . $attrs['location'] . '</b></p>';
       $sequences_html .= $attrs['formatted_seq'];
       $sequences_html .= '<a href="#sequences-top">back to top</a>';
       $sequences_html .= '</div>';
@@ -151,19 +151,23 @@ if ($residues or count($featureloc_sequences) > 0) {
 
     // check to see if this alignment has any CDS. If so, generate a CDS sequence
     $cds_sequence = tripal_get_feature_sequences(
-        array(
-          'feature_id' => $feature->feature_id,
-          'parent_id' => $attrs['featureloc']->srcfeature_id->feature_id,
-          'name' => $feature->name,
-          'featureloc_id' => $attrs['featureloc']->featureloc_id,
-        ),
-        array(
-          'width' => $num_bases,  // FASTA sequence should have $num_bases chars per line
-          'derive_from_parent' => 1, // CDS are in parent-child relationships so we want to use the sequence from the parent
-          'aggregate' => 1, // we want to combine all CDS for this feature into a single sequence
-          'sub_feature_types' => array('CDS'), // we're looking for CDS features
-          'is_html' => 1
-        )
+      [
+        'feature_id' => $feature->feature_id,
+        'parent_id' => $attrs['featureloc']->srcfeature_id->feature_id,
+        'name' => $feature->name,
+        'featureloc_id' => $attrs['featureloc']->featureloc_id,
+      ],
+      [
+        'width' => $num_bases,
+        // FASTA sequence should have $num_bases chars per line
+        'derive_from_parent' => 1,
+        // CDS are in parent-child relationships so we want to use the sequence from the parent
+        'aggregate' => 1,
+        // we want to combine all CDS for this feature into a single sequence
+        'sub_feature_types' => ['CDS'],
+        // we're looking for CDS features
+        'is_html' => 1,
+      ]
     );
     if (count($cds_sequence) > 0) {
       // the tripal_get_feature_sequences() function can return multiple sequences
@@ -186,7 +190,9 @@ if ($residues or count($featureloc_sequences) > 0) {
   }
   ?>
 
-  <div class="tripal_feature-data-block-desc tripal-data-block-desc">The following sequences are available for this feature:</div>
+    <div class="tripal_feature-data-block-desc tripal-data-block-desc">The
+        following sequences are available for this feature:
+    </div>
   <?php
 
   // first add a list at the top of the page that can be formatted as the
@@ -195,12 +201,12 @@ if ($residues or count($featureloc_sequences) > 0) {
   // to create the list can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_item_list/7
   print '<a name="sequences-top"></a>';
-  print theme_item_list(array(
+  print theme_item_list([
     'items' => $list_items,
     'title' => '',
     'type' => 'ul',
-    'attributes' => array(),
-  ));
+    'attributes' => [],
+  ]);
 
   $message = 'Administrators, sequences will appear on this page if:
     <br><br><b>For any feature type:</b>
@@ -223,7 +229,7 @@ if ($residues or count($featureloc_sequences) > 0) {
           shown.</li>
     </ul>
     </p>';
-  print tripal_set_message($message, TRIPAL_INFO, array('return_html' => 1));
+  print tripal_set_message($message, TRIPAL_INFO, ['return_html' => 1]);
 
   // now print the sequences
   print $sequences_html;

+ 23 - 21
legacy/tripal_feature/theme/templates/tripal_feature_synonyms.tpl.php

@@ -3,49 +3,51 @@ $feature = $variables['node']->feature;
 
 // expand the feature object to include the synonyms from the feature_synonym 
 // table in chado.
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $feature = chado_expand_var($feature, 'table', 'feature_synonym', $options);
 $synonyms = $feature->feature_synonym;
 
-if(count($synonyms) > 0){ ?>
-  <div class="tripal_feature-data-block-desc tripal-data-block-desc">The feature '<?php print $feature->name ?>' has the following synonyms</div><?php
-  
+if (count($synonyms) > 0) { ?>
+    <div class="tripal_feature-data-block-desc tripal-data-block-desc">The
+    feature '<?php print $feature->name ?>' has the following
+    synonyms</div><?php
+
   // the $headers array is an array of fields to use as the colum headers. 
   // additional documentation can be found here 
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
   // This table for the analysis has a vertical header (down the first column)
   // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array('Synonym');
-  
+  $headers = ['Synonym'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
-  foreach ($synonyms as $feature_synonym){
-    $rows[] = array(
-      $feature_synonym->synonym_id->name
-    );
-  } 
-  
+  $rows = [];
+  foreach ($synonyms as $feature_synonym) {
+    $rows[] = [
+      $feature_synonym->synonym_id->name,
+    ];
+  }
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_feature-table-synonyms',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-    print theme_table($table);
+  print theme_table($table);
 }

+ 8 - 8
legacy/tripal_feature/theme/templates/tripal_feature_teaser.tpl.php

@@ -2,12 +2,12 @@
 $node = $variables['node'];
 $feature = $variables['node']->feature; ?>
 
-<div class="tripal_feature-teaser tripal-teaser"> 
-  <div class="tripal-feature-teaser-title tripal-teaser-title"><?php 
-    print l($node->title, "node/$node->nid", array('html' => TRUE));?>
-  </div>
-  <div class="tripal-feature-teaser-text tripal-teaser-text"><?php 
-    print $node->title;
-    print "... " . l("[more]", "node/$node->nid"); ?>
-  </div>
+<div class="tripal_feature-teaser tripal-teaser">
+    <div class="tripal-feature-teaser-title tripal-teaser-title"><?php
+      print l($node->title, "node/$node->nid", ['html' => TRUE]); ?>
+    </div>
+    <div class="tripal-feature-teaser-text tripal-teaser-text"><?php
+      print $node->title;
+      print "... " . l("[more]", "node/$node->nid"); ?>
+    </div>
 </div>

+ 20 - 17
legacy/tripal_feature/theme/templates/tripal_feature_terms.tpl.php

@@ -2,12 +2,12 @@
 
 $feature = $variables['node']->feature;
 
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $feature = chado_expand_var($feature, 'table', 'feature_cvterm', $options);
 $terms = $feature->feature_cvterm;
 
 // order the terms by CV
-$s_terms = array();
+$s_terms = [];
 if ($terms) {
   foreach ($terms as $term) {
     $s_terms[$term->cvterm_id->cv_id->name][] = $term;
@@ -15,7 +15,10 @@ if ($terms) {
 }
 
 if (count($s_terms) > 0) { ?>
-  <div class="tripal_feature-data-block-desc tripal-data-block-desc">The following terms have been associated with this <?php print $node->feature->type_id->name ?>:</div>  <?php
+    <div class="tripal_feature-data-block-desc tripal-data-block-desc">The
+        following terms have been associated with
+        this <?php print $node->feature->type_id->name ?>:
+    </div>  <?php
 
   // iterate through each term
   $i = 0;
@@ -23,13 +26,13 @@ if (count($s_terms) > 0) { ?>
     // the $headers array is an array of fields to use as the colum headers.
     // additional documentation can be found here
     // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Term', 'Definition');
+    $headers = ['Term', 'Definition'];
 
     // the $rows array contains an array of rows where each row is an array
     // of values for each column of the table in that row.  Additional documentation
     // can be found here:
     // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+    $rows = [];
 
     foreach ($terms as $term) {
       $accession = $term->cvterm_id->dbxref_id->accession;
@@ -37,13 +40,13 @@ if (count($s_terms) > 0) { ?>
         $accession = $term->cvterm_id->dbxref_id->db_id->name . ":" . $term->cvterm_id->dbxref_id->accession;
       }
       if ($term->cvterm_id->dbxref_id->db_id->urlprefix) {
-        $accession = l($accession, $term->cvterm_id->dbxref_id->db_id->urlprefix . $accession, array('attributes' => array("target" => '_blank')));
+        $accession = l($accession, $term->cvterm_id->dbxref_id->db_id->urlprefix . $accession, ['attributes' => ["target" => '_blank']]);
       }
 
-      $rows[] = array(
-        array('data' => $accession, 'width' => '15%'),
-        $term->cvterm_id->name
-      );
+      $rows[] = [
+        ['data' => $accession, 'width' => '15%'],
+        $term->cvterm_id->name,
+      ];
     }
 
     // generate the link to configure a database, b ut only if the user is
@@ -51,25 +54,25 @@ if (count($s_terms) > 0) { ?>
     $configure_link = '';
     if (user_access('view ids')) {
       $db_id = $term->cvterm_id->dbxref_id->db_id->db_id;
-      $configure_link = l('[configure term links]', "admin/tripal/legacy/tripal_db/edit/$db_id", array('attributes' => array("target" => '_blank')));
+      $configure_link = l('[configure term links]', "admin/tripal/legacy/tripal_db/edit/$db_id", ['attributes' => ["target" => '_blank']]);
     }
 
     // the $table array contains the headers and rows array as well as other
     // options for controlling the display of the table.  Additional
     // documentation can be found here:
     // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
+    $table = [
       'header' => $headers,
       'rows' => $rows,
-      'attributes' => array(
+      'attributes' => [
         'id' => "tripal_feature-table-terms-$i",
-        'class' => 'tripal-data-table'
-      ),
+        'class' => 'tripal-data-table',
+      ],
       'sticky' => FALSE,
       'caption' => 'Vocabulary:  <b>' . ucwords(preg_replace('/_/', ' ', $cv)) . '</b> ' . $configure_link,
-      'colgroups' => array(),
+      'colgroups' => [],
       'empty' => '',
-    );
+    ];
 
     // once we have our table array structure defined, we call Drupal's theme_table()
     // function to generate the table.

+ 49 - 46
legacy/tripal_feature/theme/templates/tripal_organism_feature_browser.tpl.php

@@ -19,86 +19,89 @@ if (count($so_terms) > 0) {
   // on and retrieves the proper set of features
   $element = 0;        // an index to specify the pager if more than one is on the page
   $num_per_page = 25;  // the number of features to show per page
-  $values = array(
+  $values = [
     'organism_id' => $organism->organism_id,
-    'type_id' => array(
-      'name' => $so_terms
-    ),
-  );
-  $columns = array('feature_id');
-  $options = array(
-    'pager' => array(
+    'type_id' => [
+      'name' => $so_terms,
+    ],
+  ];
+  $columns = ['feature_id'];
+  $options = [
+    'pager' => [
       'limit' => $num_per_page,
-      'element' => $element
-     ),
-    'order_by' => array('name' => 'ASC'),
-  );
+      'element' => $element,
+    ],
+    'order_by' => ['name' => 'ASC'],
+  ];
   $results = chado_select_record('feature', $columns, $values, $options);
 
   // now that we have all of the feature IDs, we want to expand each one so that we
   // have all of the neccessary values, including the node ID, if one exists, and the
   // cvterm type name.
-  $features = array();
+  $features = [];
   foreach ($results as $result) {
-    $values = array('feature_id' => $result->feature_id);
-    $options = array(
-      'include_fk' => array(
-        'type_id' => 1
-      )
-    );
+    $values = ['feature_id' => $result->feature_id];
+    $options = [
+      'include_fk' => [
+        'type_id' => 1,
+      ],
+    ];
     $features[] = chado_generate_var('feature', $values, $options);
   }
 
   if (count($features) > 0) { ?>
-    <div class="tripal_organism-data-block-desc tripal-data-block-desc">The following browser provides a quick view for new visitors.  Use the searching mechanism to find specific features.</div> <?php
+      <div class="tripal_organism-data-block-desc tripal-data-block-desc">The
+          following browser provides a quick view for new visitors. Use the
+          searching mechanism to find specific features.
+      </div> <?php
 
     // the $headers array is an array of fields to use as the colum headers.
     // additional documentation can be found here
     // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Feature Name' ,'Unique Name', 'Type');
+    $headers = ['Feature Name', 'Unique Name', 'Type'];
 
     // the $rows array contains an array of rows where each row is an array
     // of values for each column of the table in that row.  Additional documentation
     // can be found here:
     // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
+    $rows = [];
 
     // let admins know they can customize the terms that appear in the list
-    print tripal_set_message("Administrators, you can specify the feature types ".
-      "that should appear in this browser or remove it from the list of resources ".
-      "by navigating to the ".
-      l("Tripal feature settings page", "admin/tripal/legacy/tripal_feature/configuration", array('attributes' => array('target' => '_blank'))),
+    print tripal_set_message("Administrators, you can specify the feature types " .
+      "that should appear in this browser or remove it from the list of resources " .
+      "by navigating to the " .
+      l("Tripal feature settings page", "admin/tripal/legacy/tripal_feature/configuration", ['attributes' => ['target' => '_blank']]),
       TRIPAL_INFO,
-      array('return_html' => 1)
+      ['return_html' => 1]
     );
 
-    foreach ($features as $feature){
-      $fname =  $feature->name;
+    foreach ($features as $feature) {
+      $fname = $feature->name;
       if (property_exists($feature, 'nid')) {
-        $fname =   l($fname, "node/$feature->nid", array('attributes' => array('target' => '_blank')));
+        $fname = l($fname, "node/$feature->nid", ['attributes' => ['target' => '_blank']]);
       }
-      $rows[] = array(
+      $rows[] = [
         $fname,
         $feature->uniquename,
-        $feature->type_id->name
-      );
+        $feature->type_id->name,
+      ];
     }
     // the $table array contains the headers and rows array as well as other
     // options for controlling the display of the table.  Additional
     // documentation can be found here:
     // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
+    $table = [
       'header' => $headers,
       'rows' => $rows,
-      'attributes' => array(
+      'attributes' => [
         'id' => 'tripal_organism-table-features',
-        'class' => 'tripal-data-table'
-      ),
+        'class' => 'tripal-data-table',
+      ],
       'sticky' => FALSE,
       'caption' => '',
-      'colgroups' => array(),
+      'colgroups' => [],
       'empty' => '',
-    );
+    ];
     // once we have our table array structure defined, we call Drupal's theme_table()
     // function to generate the table.
     print theme_table($table);
@@ -113,14 +116,14 @@ if (count($so_terms) > 0) {
     // Drupal won't reset the parameter if it already exists.
     $get = $_GET;
     unset($_GET['pane']);
-    $pager = array(
-      'tags' => array(),
+    $pager = [
+      'tags' => [],
       'element' => $element,
-      'parameters' => array(
-        'pane' => 'feature_browser'
-      ),
+      'parameters' => [
+        'pane' => 'feature_browser',
+      ],
       'quantity' => $num_per_page,
-    );
+    ];
     print theme_pager($pager);
     $_GET = $get;
 
@@ -128,7 +131,7 @@ if (count($so_terms) > 0) {
       Administrators, please note that the feature browser will be retired in
       a future version of Tripal.",
       TRIPAL_INFO,
-      array('return_html' => 1));
+      ['return_html' => 1]);
   }
 }
 

+ 20 - 18
legacy/tripal_feature/theme/templates/tripal_organism_feature_counts.tpl.php

@@ -1,64 +1,66 @@
 <?php
 
 $organism = $variables['node']->organism;
-$types = array();
+$types = [];
 
-if(property_exists($organism, 'feature_counts')) {
-  $types    = $organism->feature_counts['types'];
-  $names    = $organism->feature_counts['names'];
+if (property_exists($organism, 'feature_counts')) {
+  $types = $organism->feature_counts['types'];
+  $names = $organism->feature_counts['names'];
 } ?>
 
-<div class="tripal_organism-data-block-desc tripal-data-block-desc">The following features are currently present for this organism</div> <?php
+    <div class="tripal_organism-data-block-desc tripal-data-block-desc">The
+        following features are currently present for this organism
+    </div> <?php
 
 // let admins know they can customize the terms that appear in the list
 print tripal_set_message("
   Administrators, you can customize the types of terms that appear in this report by navigating to the " .
-  l('Tripal feature configuration page', 'admin/tripal/legacy/tripal_feature/configuration', array('attributes' => array('target' => '_blank'))) . "
+  l('Tripal feature configuration page', 'admin/tripal/legacy/tripal_feature/configuration', ['attributes' => ['target' => '_blank']]) . "
   opening the section \"Feature Summary Report\" and adding the list of
   terms you want to appear in the list. You can rename terms as well. To refresh the data,re-populate the " .
-  l('organism_feature_count', 'admin/tripal/storage/legacy/mviews', array('attributes' => array('target' => '_blank'))) . "
+  l('organism_feature_count', 'admin/tripal/storage/legacy/mviews', ['attributes' => ['target' => '_blank']]) . "
   materialized view.",
   TRIPAL_INFO,
-  array('return_html' => 1)
+  ['return_html' => 1]
 );
 
 // the $headers array is an array of fields to use as the colum headers.
 // additional documentation can be found here
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-$headers = array('Feature Type' ,'Count');
+$headers = ['Feature Type', 'Count'];
 
 // the $rows array contains an array of rows where each row is an array
 // of values for each column of the table in that row.  Additional documentation
 // can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-$rows = array();
+$rows = [];
 
 for ($j = 0; $j < count($types); $j++) {
   $type = $types[$j];
   $name = $names[$j];
 
-  $rows[] = array(
+  $rows[] = [
     "<span title=\"" . $type->definition . "\">$name</span>",
     number_format($type->num_features),
-  );
+  ];
 }
 // the $table array contains the headers and rows array as well as other
 // options for controlling the display of the table.  Additional
 // documentation can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-$table = array(
+$table = [
   'header' => $headers,
   'rows' => $rows,
-  'attributes' => array(
+  'attributes' => [
     'id' => 'tripal_organism-table-features',
-    'class' => 'tripal-data-table'
-  ),
+    'class' => 'tripal-data-table',
+  ],
   'sticky' => FALSE,
   'caption' => '',
-  'colgroups' => array(),
+  'colgroups' => [],
   'empty' => 'There are no feature counts to report.  If you have loaded features for this
     organism then re-populate the organism_feature_count materialized view.',
-);
+];
 // once we have our table array structure defined, we call Drupal's theme_table()
 // function to generate the table.
 print theme_table($table);

+ 154 - 133
legacy/tripal_feature/theme/tripal_feature.theme.inc

@@ -9,14 +9,14 @@ function tripal_feature_preprocess_tripal_feature_sequence(&$variables) {
   $feature = $variables['node']->feature;
 
   // get the featureloc src features
-  $options = array(
+  $options = [
     'return_array' => 1,
-    'include_fk' => array(
-      'srcfeature_id' => array(
-        'type_id' => 1
-      ),
-    ),
-  );
+    'include_fk' => [
+      'srcfeature_id' => [
+        'type_id' => 1,
+      ],
+    ],
+  ];
 
   $feature = chado_expand_var($feature, 'table', 'featureloc', $options);
 
@@ -48,14 +48,14 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
 
   // if we don't have any featurelocs then no point in continuing
   if (!$featurelocs) {
-    return array();
+    return [];
   }
 
   // get the list of relationships (including any aggregators) and iterate
   // through each one to find information needed to color-code the reference sequence
   $relationships = tripal_feature_get_aggregate_relationships($feature_id);
   if (!$relationships) {
-    return array();
+    return [];
   }
 
 
@@ -74,19 +74,19 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
       $rel->featurelocs = new stdClass();
       $rel->featurelocs->$src = new stdClass();
       $rel->featurelocs->$src->src_uniquename = $rel_featureloc->src_uniquename;
-      $rel->featurelocs->$src->src_cvterm_id  = $rel_featureloc->src_cvterm_id;
-      $rel->featurelocs->$src->src_cvname     = $rel_featureloc->src_cvname;
-      $rel->featurelocs->$src->fmin           = $rel_featureloc->fmin;
-      $rel->featurelocs->$src->fmax           = $rel_featureloc->fmax;
-      $rel->featurelocs->$src->src_name       = $rel_featureloc->src_name;
+      $rel->featurelocs->$src->src_cvterm_id = $rel_featureloc->src_cvterm_id;
+      $rel->featurelocs->$src->src_cvname = $rel_featureloc->src_cvname;
+      $rel->featurelocs->$src->fmin = $rel_featureloc->fmin;
+      $rel->featurelocs->$src->fmax = $rel_featureloc->fmax;
+      $rel->featurelocs->$src->src_name = $rel_featureloc->src_name;
 
       // keep track of the individual parts for each relationship
       $start = $rel->featurelocs->$src->fmin;
-      $end   = $rel->featurelocs->$src->fmax;
-      $type  = $rel->subject_type;
+      $end = $rel->featurelocs->$src->fmax;
+      $type = $rel->subject_type;
       $rel_locs[$src]['parts'][$start][$type]['start'] = $start;
-      $rel_locs[$src]['parts'][$start][$type]['end']   = $end;
-      $rel_locs[$src]['parts'][$start][$type]['type']  = $type;
+      $rel_locs[$src]['parts'][$start][$type]['end'] = $end;
+      $rel_locs[$src]['parts'][$start][$type]['type'] = $type;
     }
   }
 
@@ -94,7 +94,7 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
   // where this feature is found.   We want to get the sequence for each
   // location and then annotate it with the parts found from the relationships
   // locations determiend above.
-  $floc_sequences = array();
+  $floc_sequences = [];
   foreach ($featurelocs as $featureloc) {
 
     // build the src name so we can keep track of the different parts for each feature
@@ -103,7 +103,7 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
     // orient the parts to the beginning of the feature sequence
     if (!empty($rel_locs[$src]['parts'])) {
       $parts = $rel_locs[$src]['parts'];
-      $rparts = array();  // we will fill this up if we're on the reverse strand
+      $rparts = [];  // we will fill this up if we're on the reverse strand
 
       foreach ($parts as $start => $types) {
         foreach ($types as $type_name => $type) {
@@ -111,8 +111,8 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
             // this is on the forward strand.  We need to convert the start on the src feature to the
             // start on this feature's sequence
             $parts[$start][$type_name]['start'] = $parts[$start][$type_name]['start'] - $featureloc->fmin;
-            $parts[$start][$type_name]['end']   = $parts[$start][$type_name]['end'] - $featureloc->fmin;
-            $parts[$start][$type_name]['type']  = $type_name;
+            $parts[$start][$type_name]['end'] = $parts[$start][$type_name]['end'] - $featureloc->fmin;
+            $parts[$start][$type_name]['type'] = $type_name;
           }
           else {
             // this is on the reverse strand.  We need to swap the start and stop and calculate from the
@@ -124,8 +124,8 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
             $new_end = $size - ($start_orig - $featureloc->fmin);
 
             $rparts[$new_start][$type_name]['start'] = $new_start;
-            $rparts[$new_start][$type_name]['end']   = $new_end;
-            $rparts[$new_start][$type_name]['type']  = $type_name;
+            $rparts[$new_start][$type_name]['end'] = $new_end;
+            $rparts[$new_start][$type_name]['type'] = $type_name;
           }
         }
       }
@@ -142,7 +142,7 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
 
       $floc_sequences[$src]['id'] = $src;
       $floc_sequences[$src]['type'] = $featureloc->feature_id->type_id->name;
-      $args = array(':feature_id' => $featureloc->srcfeature_id->feature_id);
+      $args = [':feature_id' => $featureloc->srcfeature_id->feature_id];
       $start = $featureloc->fmin + 1;
       $size = $featureloc->fmax - $featureloc->fmin;
 
@@ -170,11 +170,12 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
       $floc_sequences[$src]['location'] = tripal_get_location_string($featureloc);
       $floc_sequences[$src]['defline'] = tripal_get_fasta_defline($featureloc->feature_id, '', $featureloc, '', strlen($residues));
       $floc_sequences[$src]['featureloc'] = $featureloc;
-      $floc_sequences[$src]['formatted_seq'] =  tripal_feature_color_sequence($residues, $parts, $floc_sequences[$src]['defline']);
+      $floc_sequences[$src]['formatted_seq'] = tripal_feature_color_sequence($residues, $parts, $floc_sequences[$src]['defline']);
     }
   }
   return $floc_sequences;
 }
+
 /**
  * Used to sort the list of relationship parts by start position
  *
@@ -191,6 +192,7 @@ function tripal_feature_sort_rel_parts_by_start($a, $b) {
   }
   return strnatcmp($astart, $bstart);
 }
+
 /**
  * Load the locations for a given feature
  *
@@ -218,18 +220,18 @@ function tripal_feature_load_featurelocs($feature_id, $side = 'as_parent', $aggr
        INNER JOIN {cvterm} CVT  ON F.type_id     = CVT.cvterm_id
        INNER JOIN {cvterm} CVTS ON FS.type_id    = CVTS.cvterm_id
    ";
-  if (strcmp($side, 'as_parent')==0) {
+  if (strcmp($side, 'as_parent') == 0) {
     $sql .= "WHERE FL.srcfeature_id = :feature_id ";
   }
-  if (strcmp($side, 'as_child')==0) {
+  if (strcmp($side, 'as_child') == 0) {
     $sql .= "WHERE FL.feature_id = :feature_id ";
   }
 
-  $flresults = chado_query($sql, array(':feature_id' => $feature_id));
+  $flresults = chado_query($sql, [':feature_id' => $feature_id]);
 
   // copy the results into an array
-  $i=0;
-  $featurelocs = array();
+  $i = 0;
+  $featurelocs = [];
   while ($loc = $flresults->fetchObject()) {
     // if a drupal node exists for this feature then add the nid to the
     // results object
@@ -240,7 +242,7 @@ function tripal_feature_load_featurelocs($feature_id, $side = 'as_parent', $aggr
   }
 
   // Add the relationship feature locs if aggregate is turned on
-  if ($aggregate and strcmp($side, 'as_parent')==0) {
+  if ($aggregate and strcmp($side, 'as_parent') == 0) {
     // get the relationships for this feature without substituting any children
     // for the parent. We want all relationships
     $relationships = tripal_feature_get_aggregate_relationships($feature_id, 0);
@@ -286,7 +288,7 @@ function tripal_feature_sort_locations($a, $b) {
 function tripal_feature_color_sequence($sequence, $parts, $defline) {
 
 
-  $types = array();
+  $types = [];
   // first get the list of types so we can create a color legend
   foreach ($parts as $index => $t) {
     foreach ($t as $type_name => $details) {
@@ -307,8 +309,8 @@ function tripal_feature_color_sequence($sequence, $parts, $defline) {
   $newseq .= ">$defline<br>";
 
   // iterate through the parts. They should be in order.
-  $starts   = array(); // an array holding all of the children starting locations
-  $ends     = array(); // an array holding all of the children's ending locations
+  $starts = []; // an array holding all of the children starting locations
+  $ends = []; // an array holding all of the children's ending locations
   $seqcount = 0;
   foreach ($parts as $index => $types) {
 
@@ -373,6 +375,7 @@ function tripal_feature_sort_rel_parts_by_end($a, $b) {
   }
   return $val;
 }
+
 /**
  *
  *
@@ -400,6 +403,7 @@ function tripal_feature_preprocess_tripal_feature_proteins(&$variables) {
     $feature->all_relationships = tripal_feature_get_feature_relationships($feature);
   }
 }
+
 /**
  *
  *
@@ -409,28 +413,28 @@ function tripal_feature_preprocess_tripal_feature_alignments(&$variables) {
 
   // we want to provide a new variable that contains the matched features.
   $feature = $variables['node']->feature;
-  $options = array(
+  $options = [
     'return_array' => 1,
-    'include_fk' => array(
-      'srcfeature_id' => array(
+    'include_fk' => [
+      'srcfeature_id' => [
         'type_id' => 1,
-      ),
-      'feature_id' => array(
-        'type_id' => 1
-      ),
-    )
-  );
+      ],
+      'feature_id' => [
+        'type_id' => 1,
+      ],
+    ],
+  ];
   $feature = chado_expand_var($feature, 'table', 'featureloc', $options);
 
   // get alignments as child
   $cfeaturelocs = $feature->featureloc->feature_id;
   if (!$cfeaturelocs) {
-    $cfeaturelocs = array();
+    $cfeaturelocs = [];
   }
   // get alignment as parent
   $pfeaturelocs = $feature->featureloc->srcfeature_id;
   if (!$pfeaturelocs) {
-    $pfeaturelocs = array();
+    $pfeaturelocs = [];
   }
 
   // get matched alignments (those with an itermediate 'match' or 'EST_match', etc
@@ -439,7 +443,7 @@ function tripal_feature_preprocess_tripal_feature_alignments(&$variables) {
 
   // combine all three alignments into a single array for printing together in
   // a single list
-  $alignments = array();
+  $alignments = [];
   foreach ($pfeaturelocs as $featureloc) {
     // if type is a 'match' then ignore it. We will handle those below
     if (preg_match('/(^match$|^.*?_match|match_part)$/', $featureloc->feature_id->type_id->name)) {
@@ -482,7 +486,7 @@ function tripal_feature_preprocess_tripal_feature_alignments(&$variables) {
   // provided to this function.
   foreach ($mfeaturelocs as $featureloc) {
     // get more information about the right feature
-    $select = array('feature_id' => $featureloc->right_srcfeature_id);
+    $select = ['feature_id' => $featureloc->right_srcfeature_id];
     $rfeature = chado_generate_var('feature', $select);
     // now add to the list
     $alignment = new stdClass();
@@ -509,6 +513,7 @@ function tripal_feature_preprocess_tripal_feature_alignments(&$variables) {
   }
   $feature->all_featurelocs = $alignments;
 }
+
 /**
  * This function is for features that align through an intermediate such
  * as 'EST_match' or 'match'.  This occurs in the case where two sequences
@@ -525,7 +530,7 @@ function tripal_feature_preprocess_tripal_feature_alignments(&$variables) {
  * alignment of feature 3 with feature 2
  *
  * Features may align to more than one feature and are not matches. We do
-   * not want to include these, so we have to filter on the SO terms:
+ * not want to include these, so we have to filter on the SO terms:
  * match, or %_match
  *
  * @ingroup tripal_legacy_feature
@@ -567,19 +572,20 @@ function tripal_feature_get_matched_alignments($feature) {
      ORDER BY FL1.fmin
    ";
 
-  $results = chado_query($sql, array(':feature_id' => $feature->feature_id));
+  $results = chado_query($sql, [':feature_id' => $feature->feature_id]);
 
   // iterate through the results and add them to our featurelocs array
-  $featurelocs = array();
+  $featurelocs = [];
   while ($fl = $results->fetchObject()) {
     // ignore featurelocs where the left and right srcfeature is the same
     if (strcmp($fl->left_srcfeature_id, $fl->right_srcfeature_id) == 0) {
       continue;
     }
-    $featurelocs[] = $fl ;
+    $featurelocs[] = $fl;
   }
   return $featurelocs;
 }
+
 /**
  *
  *
@@ -589,6 +595,7 @@ function tripal_feature_preprocess_tripal_organism_feature_counts(&$variables, $
   $organism = $variables['node']->organism;
   $organism->feature_counts = tripal_feature_load_organism_feature_counts($organism);
 }
+
 /**
  * Load the arguments for the organism feature counts browser
  *
@@ -599,13 +606,13 @@ function tripal_feature_preprocess_tripal_organism_feature_counts(&$variables, $
  */
 function tripal_feature_load_organism_feature_counts($organism) {
 
-  $args = array();
-  $order = array();
-  $names = array();
+  $args = [];
+  $order = [];
+  $names = [];
 
   // We should not assume this table is present since it is a materialized view.
   if (!chado_table_exists('organism_feature_count')) {
-      return NULL;
+    return NULL;
   }
 
   // build the where clause for the SQL statement if we have a custom term list
@@ -628,7 +635,7 @@ function tripal_feature_load_organism_feature_counts($organism) {
 
       // if the admin specified a new name then store that otherwise use the
       // the default sequence ontology term name
-      if(count($temp2) == 2) {
+      if (count($temp2) == 2) {
         $names[] = rtrim($temp2[1]);
       }
       else {
@@ -655,7 +662,7 @@ function tripal_feature_load_organism_feature_counts($organism) {
   $org_features = chado_query($sql, $args);
 
   // iterate through the types
-  $types = array();
+  $types = [];
   while ($type = $org_features->fetchObject()) {
     $types[$type->feature_type] = $type;
     // if we don't have an order this means we didn't go through the loop
@@ -667,16 +674,16 @@ function tripal_feature_load_organism_feature_counts($organism) {
   }
 
   // now reorder the types
-  $ordered_types = array();
+  $ordered_types = [];
   foreach ($order as $type) {
     if (array_key_exists($type, $types)) {
       $ordered_types[] = $types[$type];
     }
   }
-  return array(
+  return [
     'types' => $ordered_types,
-    'names' => $names
-  );
+    'names' => $names,
+  ];
 }
 
 /**
@@ -688,7 +695,7 @@ function tripal_feature_load_organism_feature_counts($organism) {
  *
  * @param $feature
  *   The feature object
-
+ *
  * @return
  *   An array with two objects
  *
@@ -696,24 +703,24 @@ function tripal_feature_load_organism_feature_counts($organism) {
  */
 function tripal_feature_get_feature_relationships($feature) {
   // expand the feature object to include the feature relationships.
-  $options = array(
+  $options = [
     'return_array' => 1,
-    'order_by' => array('rank' => 'ASC'),
+    'order_by' => ['rank' => 'ASC'],
     // we don't want to fully recurse we only need information about the
     // relationship type and the object and subject features (including feature type
     // and organism)
-    'include_fk' => array(
+    'include_fk' => [
       'type_id' => 1,
-      'object_id' => array(
+      'object_id' => [
         'type_id' => 1,
-        'organism_id' => 1
-      ),
-      'subject_id'  => array(
+        'organism_id' => 1,
+      ],
+      'subject_id' => [
         'type_id' => 1,
-        'organism_id' => 1
-      ),
-    ),
-  );
+        'organism_id' => 1,
+      ],
+    ],
+  ];
   $feature = chado_expand_var($feature, 'table', 'feature_relationship', $options);
 
   // get the subject relationships
@@ -723,19 +730,19 @@ function tripal_feature_get_feature_relationships($feature) {
 
   // get alignment as child. The $feature->featureloc element
   // is already populated from the alignment preprocess function
-  $options = array(
-    'include_fk' => array(
+  $options = [
+    'include_fk' => [
       'srcfeature_id' => 1,
       'feature_id' => 1,
-    ),
-  );
+    ],
+  ];
   $feature = chado_expand_var($feature, 'table', 'featureloc', $options);
   $cfeaturelocs = $feature->featureloc->feature_id;
   if (!$cfeaturelocs) {
-    $cfeaturelocs = array();
+    $cfeaturelocs = [];
   }
   elseif (!is_array($cfeaturelocs)) {
-    $cfeaturelocs = array($cfeaturelocs);
+    $cfeaturelocs = [$cfeaturelocs];
   }
 
   // prepare the SQL statement to get the featureloc for the
@@ -750,9 +757,9 @@ function tripal_feature_get_feature_relationships($feature) {
   ";
 
   // combine both object and subject relationshisp into a single array
-  $relationships = array();
-  $relationships['object'] = array();
-  $relationships['subject'] = array();
+  $relationships = [];
+  $relationships['object'] = [];
+  $relationships['subject'] = [];
 
   // iterate through the object relationships
   if ($orelationships) {
@@ -760,9 +767,12 @@ function tripal_feature_get_feature_relationships($feature) {
       $rel = new stdClass();
       // get locations where the child feature and this feature overlap with the
       // same landmark feature.
-      $rel->child_featurelocs = array();
+      $rel->child_featurelocs = [];
       foreach ($cfeaturelocs as $featureloc) {
-        $res = chado_query($flrels_sql, array(':feature_id' => $relationship->subject_id->feature_id, ':srcfeature_id' => $featureloc->srcfeature_id->feature_id));
+        $res = chado_query($flrels_sql, [
+          ':feature_id' => $relationship->subject_id->feature_id,
+          ':srcfeature_id' => $featureloc->srcfeature_id->feature_id,
+        ]);
         while ($loc = $res->fetchObject()) {
           // add in the node id of the src feature if it exists and save this location
           if (property_exists($featureloc->srcfeature_id, 'nid')) {
@@ -779,16 +789,16 @@ function tripal_feature_get_feature_relationships($feature) {
 
       // get the node id of the subject
       $sql = "SELECT nid FROM {chado_feature} WHERE feature_id = :feature_id";
-      $n = db_query($sql, array(':feature_id' => $relationship->subject_id->feature_id))->fetchObject();
+      $n = db_query($sql, [':feature_id' => $relationship->subject_id->feature_id])->fetchObject();
       if ($n) {
         $rel->record->nid = $n->nid;
       }
 
       if (!array_key_exists($rel_type, $relationships['object'])) {
-        $relationships['object'][$rel_type] = array();
+        $relationships['object'][$rel_type] = [];
       }
       if (!array_key_exists($child_type, $relationships['object'][$rel_type])) {
-        $relationships['object'][$rel_type][$child_type] = array();
+        $relationships['object'][$rel_type][$child_type] = [];
       }
       $relationships['object'][$rel_type][$child_type][] = $rel;
     }
@@ -799,9 +809,12 @@ function tripal_feature_get_feature_relationships($feature) {
     foreach ($srelationships as $relationship) {
       $rel = new stdClass();
       // get locations where this feature overlaps with the parent
-      $rel->parent_featurelocs = array();
+      $rel->parent_featurelocs = [];
       foreach ($cfeaturelocs as $featureloc) {
-        $res = chado_query($flrels_sql, array(':feature_id' => $relationship->object_id->feature_id, ':srcfeature_id' => $featureloc->srcfeature_id->feature_id));
+        $res = chado_query($flrels_sql, [
+          ':feature_id' => $relationship->object_id->feature_id,
+          ':srcfeature_id' => $featureloc->srcfeature_id->feature_id,
+        ]);
         while ($loc = $res->fetchObject()) {
           // add in the node id of the src feature if it exists and save this location
           if (property_exists($featureloc->srcfeature_id, 'nid')) {
@@ -816,16 +829,16 @@ function tripal_feature_get_feature_relationships($feature) {
 
       // get the node id of the subject
       $sql = "SELECT nid FROM {chado_feature} WHERE feature_id = :feature_id";
-      $n = db_query($sql, array(':feature_id' => $relationship->object_id->feature_id))->fetchObject();
+      $n = db_query($sql, [':feature_id' => $relationship->object_id->feature_id])->fetchObject();
       if ($n) {
         $rel->record->nid = $n->nid;
       }
 
       if (!array_key_exists($rel_type, $relationships['subject'])) {
-        $relationships['subject'][$rel_type] = array();
+        $relationships['subject'][$rel_type] = [];
       }
       if (!array_key_exists($parent_type, $relationships['subject'][$rel_type])) {
-        $relationships['subject'][$rel_type][$parent_type] = array();
+        $relationships['subject'][$rel_type][$parent_type] = [];
       }
       $relationships['subject'][$rel_type][$parent_type][] = $rel;
     }
@@ -840,8 +853,8 @@ function tripal_feature_preprocess_tripal_feature_bar_chart_type_organism_summar
 
   // Add in all the javascript/css files.
   tripal_add_d3js();
-  drupal_add_css(drupal_get_path('module','tripal_feature') . '/theme/css/tripal_feature.css');
-  drupal_add_js(drupal_get_path('module','tripal_feature') . '/theme/js/tripalFeature.adminChart.js');
+  drupal_add_css(drupal_get_path('module', 'tripal_feature') . '/theme/css/tripal_feature.css');
+  drupal_add_js(drupal_get_path('module', 'tripal_feature') . '/theme/js/tripalFeature.adminChart.js');
 
   // Retrieve and process all the data and save it as javascript settings.
   //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -850,15 +863,22 @@ function tripal_feature_preprocess_tripal_feature_bar_chart_type_organism_summar
   // Thus grab all the records from this materialized view.
   $organism_feature_count = chado_select_record(
     'organism_feature_count',
-    array('*'),
-    array(),
-    array('order_by' => array('genus' => 'ASC', 'species' => 'ASC', 'feature_type' => 'ASC', 'num_features' => 'DESC'))
+    ['*'],
+    [],
+    [
+      'order_by' => [
+        'genus' => 'ASC',
+        'species' => 'ASC',
+        'feature_type' => 'ASC',
+        'num_features' => 'DESC',
+      ],
+    ]
   );
 
   // Initialize variables.
-  $chart = array();
-  $type_names = array();
-  $organism_names = array();
+  $chart = [];
+  $type_names = [];
+  $organism_names = [];
   $max_bar_height = 0;
 
   // Process each row of the materialzied view into the chart array.
@@ -880,10 +900,10 @@ function tripal_feature_preprocess_tripal_feature_bar_chart_type_organism_summar
 
     // Save information about the current organism. This isn't actually used by the
     // chart but can be used to debug the bar generation to follow.
-    $chart[$row->cvterm_id]['organisms'][] = array(
+    $chart[$row->cvterm_id]['organisms'][] = [
       'name' => $row->genus . ' ' . $row->species,
-      'value' => (int) $row->num_features
-    );
+      'value' => (int) $row->num_features,
+    ];
 
     // Now to build the bar array with the start (y0) and end (y1) height on the
     // bar for a given organism.
@@ -901,11 +921,11 @@ function tripal_feature_preprocess_tripal_feature_bar_chart_type_organism_summar
       $chart[$row->cvterm_id]['y1'] = $chart[$row->cvterm_id]['y0'] + $row->num_features;
     }
     // Now save the bar chunk we just determined.
-    $chart[$row->cvterm_id]['bars'][] = array(
+    $chart[$row->cvterm_id]['bars'][] = [
       'name' => $row->genus . ' ' . $row->species,
       'y0' => $chart[$row->cvterm_id]['y0'],
       'y1' => $chart[$row->cvterm_id]['y1'],
-    );
+    ];
 
     // We also need to keep track of the total number of features for a single bar (Type).
     $chart[$row->cvterm_id]['total_features'] = (int) $chart[$row->cvterm_id]['y1'];
@@ -927,10 +947,10 @@ function tripal_feature_preprocess_tripal_feature_bar_chart_type_organism_summar
     SELECT mview_id, name, last_update
     FROM tripal_mviews
     WHERE mv_table=:mv_table',
-    array(':mv_table' => 'organism_feature_count')
+    [':mv_table' => 'organism_feature_count']
   )->fetchObject();
 
-  $vars['chart_details'] = array(
+  $vars['chart_details'] = [
     'summary' => $chart,
     'types' => $type_names,
     'organisms' => $organism_names,
@@ -939,16 +959,17 @@ function tripal_feature_preprocess_tripal_feature_bar_chart_type_organism_summar
     'mviewUrl' => url('admin/tripal/storage/chado/mviews/update/' . $mview->mview_id),
     'mviewTable' => $mview->name,
     'mviewLastUpdate' => $mview->last_update ? format_date($mview->last_update) : '',
-  );
+  ];
 
   // Save everything we just determined as a Drupal JS settings so that we have access to
   // it in our js script.
-  drupal_add_js(array('tripalFeature' => array('admin' => $vars['chart_details'])), 'setting');
+  drupal_add_js(['tripalFeature' => ['admin' => $vars['chart_details']]], 'setting');
 }
 
 
 /**
- * Get features related to the current feature to a given depth. Recursive function.
+ * Get features related to the current feature to a given depth. Recursive
+ * function.
  *
  * @param $feature_id
  * @param $substitute
@@ -957,19 +978,19 @@ function tripal_feature_preprocess_tripal_feature_bar_chart_type_organism_summar
  * @param $depth
  *
  */
-function tripal_feature_get_aggregate_relationships($feature_id, $substitute=1,
-  $levels=0, $base_type_id=NULL, $depth=0) {
-    
-    // we only want to recurse to as many levels deep as indicated by the
-    // $levels variable, but only if this variable is > 0. If 0 then we
-    // recurse until we reach the end of the relationships tree.
-    if ($levels > 0 and $levels == $depth) {
-      return NULL;
-    }
-    
-    // first get the relationships for this feature
-    return tripal_feature_load_relationships($feature_id, 'as_object');
-    
+function tripal_feature_get_aggregate_relationships($feature_id, $substitute = 1,
+                                                    $levels = 0, $base_type_id = NULL, $depth = 0) {
+
+  // we only want to recurse to as many levels deep as indicated by the
+  // $levels variable, but only if this variable is > 0. If 0 then we
+  // recurse until we reach the end of the relationships tree.
+  if ($levels > 0 and $levels == $depth) {
+    return NULL;
+  }
+
+  // first get the relationships for this feature
+  return tripal_feature_load_relationships($feature_id, 'as_object');
+
 }
 
 /**
@@ -1001,28 +1022,28 @@ function tripal_feature_load_relationships($feature_id, $side = 'as_subject') {
      INNER JOIN {cvterm} CVTO ON FO.type_id    = CVTO.cvterm_id
      INNER JOIN {cvterm} CVTS ON FS.type_id    = CVTS.cvterm_id
   ";
-  if (strcmp($side, 'as_object')==0) {
+  if (strcmp($side, 'as_object') == 0) {
     $sql .= " WHERE FR.object_id = :feature_id";
   }
-  if (strcmp($side, 'as_subject')==0) {
+  if (strcmp($side, 'as_subject') == 0) {
     $sql .= " WHERE FR.subject_id = :feature_id";
   }
   $sql .= " ORDER BY FR.rank";
-  
+
   // Get the relationships.
-  $results = chado_query($sql, array(':feature_id' => $feature_id));
-  
+  $results = chado_query($sql, [':feature_id' => $feature_id]);
+
   // Iterate through the relationships, put these in an array and add
   // in the Drupal node id if one exists.
-  $i=0;
+  $i = 0;
   $nodesql = "SELECT nid FROM {chado_feature} WHERE feature_id = :feature_id";
-  $relationships = array();
+  $relationships = [];
   while ($rel = $results->fetchObject()) {
-    $node = db_query($nodesql, array(':feature_id' => $rel->subject_id))->fetchObject();
+    $node = db_query($nodesql, [':feature_id' => $rel->subject_id])->fetchObject();
     if ($node) {
       $rel->subject_nid = $node->nid;
     }
-    $node = db_query($nodesql, array(':feature_id' => $rel->object_id))->fetchObject();
+    $node = db_query($nodesql, [':feature_id' => $rel->object_id])->fetchObject();
     if ($node) {
       $rel->object_nid = $node->nid;
     }

+ 45 - 45
legacy/tripal_feature/tripal_feature.drush.inc

@@ -28,40 +28,40 @@ function tripal_feature_drush_help($command) {
  * @ingroup tripal_drush
  */
 function tripal_feature_drush_command() {
-  $items = array();
-  $items['tripal-get-sequence'] = array(
+  $items = [];
+  $items['tripal-get-sequence'] = [
     'description' => dt('Prints sequences that match specified categories.'),
-    'options'    => array(
-      'org'      => dt('The organism\'s common name. If specified, features for this organism will be retrieved.'),
-      'genus'    => dt('The organism\'s genus. If specified, features for all organism with this genus will be retrieved.'),
-      'species'  => dt('The organism\'s species name. If specified, features for this all organism with this species will be retrieved.'),
+    'options' => [
+      'org' => dt('The organism\'s common name. If specified, features for this organism will be retrieved.'),
+      'genus' => dt('The organism\'s genus. If specified, features for all organism with this genus will be retrieved.'),
+      'species' => dt('The organism\'s species name. If specified, features for this all organism with this species will be retrieved.'),
       'analysis' => dt('The analysis name. If specified, features for this analysis will be retrieved.'),
-      'type'     => dt('The type of feature to retrieve (e.g. mRNA). All features that match this type will be retrieved.'),
-      'name'     => dt('The name of the feature to retrieve.'),
-      'up'       => dt('An integer value specifying the number of upstream bases to include.'),
-      'down'     => dt('An integer value specifying the number of downstream bases to incldue.'),
-      'parent'   => dt('Set this argument to 1 to retrieve the sequence from the parent in an alignment rather than the residues column of the feature itself.'),
-      'agg'      => dt('Set this argument to 1 to aggregate sub features into a single sequence.  This is useful, for example, for obtaining CDS sequence from an mRNA'),
-      'child'    => dt('Set this argument to the exact sequence ontology term for the children to aggregate.  This is useful in the case where a gene has exons as well as CDSs and UTRs.  You may sepcify as many feature types as desired by separating each with a single comma (no spaces). Term matching is case-sensitive.'),
-      'relationship'  => dt('Retrieves the sequence of any feature in the specified relationship with the matched features.'),
+      'type' => dt('The type of feature to retrieve (e.g. mRNA). All features that match this type will be retrieved.'),
+      'name' => dt('The name of the feature to retrieve.'),
+      'up' => dt('An integer value specifying the number of upstream bases to include.'),
+      'down' => dt('An integer value specifying the number of downstream bases to incldue.'),
+      'parent' => dt('Set this argument to 1 to retrieve the sequence from the parent in an alignment rather than the residues column of the feature itself.'),
+      'agg' => dt('Set this argument to 1 to aggregate sub features into a single sequence.  This is useful, for example, for obtaining CDS sequence from an mRNA'),
+      'child' => dt('Set this argument to the exact sequence ontology term for the children to aggregate.  This is useful in the case where a gene has exons as well as CDSs and UTRs.  You may sepcify as many feature types as desired by separating each with a single comma (no spaces). Term matching is case-sensitive.'),
+      'relationship' => dt('Retrieves the sequence of any feature in the specified relationship with the matched features.'),
       'rel_part' => dt('If a relationship is provided, then this will be "subject" or "object" indicating the side of the relationship for the matched features. If the matched features are the "object" then the "subject" features will have their sequences included in the output (and vice versa).'),
-      'width'    => dt('The number of nucleotides per row (defaults to 50).')
-    ),
-    'examples' => array(
+      'width' => dt('The number of nucleotides per row (defaults to 50).'),
+    ],
+    'examples' => [
       'Standard example' => 'drush tripal-current-job',
-    ),
-    'aliases' => array('trp-get-seq'),
-  );
-  $items['tripal-feature-sync'] = array(
+    ],
+    'aliases' => ['trp-get-seq'],
+  ];
+  $items['tripal-feature-sync'] = [
     'description' => dt('Syncs an individual feature.'),
-    'options'   => array(
-      'id'    => dt('The feature ID of the feature to sync'),
-    ),
-    'examples' => array(
+    'options' => [
+      'id' => dt('The feature ID of the feature to sync'),
+    ],
+    'examples' => [
       'Standard example' => 'drush tripal-feature-sync --id=48273',
-    ),
-    'aliases' => array('trp-fsync'),
-  );
+    ],
+    'aliases' => ['trp-fsync'],
+  ];
   return $items;
 }
 
@@ -72,27 +72,27 @@ function tripal_feature_drush_command() {
  */
 function drush_tripal_feature_tripal_get_sequence() {
 
-  $org_commonname     = drush_get_option('org');
-  $genus              = drush_get_option('genus');
-  $species            = drush_get_option('species');
-  $analysis_name      = drush_get_option('analysis');
-  $type               = drush_get_option('type');
-  $feature_name       = drush_get_option('name');
-  $upstream           = drush_get_option('up')   ? drush_get_option('up') : 0;
-  $downstream         = drush_get_option('down') ? drush_get_option('down') : 0;
+  $org_commonname = drush_get_option('org');
+  $genus = drush_get_option('genus');
+  $species = drush_get_option('species');
+  $analysis_name = drush_get_option('analysis');
+  $type = drush_get_option('type');
+  $feature_name = drush_get_option('name');
+  $upstream = drush_get_option('up') ? drush_get_option('up') : 0;
+  $downstream = drush_get_option('down') ? drush_get_option('down') : 0;
   $derive_from_parent = drush_get_option('parent');
-  $aggregate          = drush_get_option('agg');
-  $child              = drush_get_option('child');
-  $relationship       = drush_get_option('relationship');
-  $rel_part           = drush_get_option('rel_part');
-  $width              = drush_get_option('width') ? drush_get_option('width') : 50;
+  $aggregate = drush_get_option('agg');
+  $child = drush_get_option('child');
+  $relationship = drush_get_option('relationship');
+  $rel_part = drush_get_option('rel_part');
+  $width = drush_get_option('width') ? drush_get_option('width') : 50;
 
   if ($relationship and !$rel_part) {
     print "Please specify both 'relationship' and a 'rel_part' arguments. Both must be used together\n";
     return;
   }
 
-  $options = array(
+  $options = [
     'org_commonname' => $org_commonname,
     'genus' => $genus,
     'species' => $species,
@@ -106,12 +106,12 @@ function drush_tripal_feature_tripal_get_sequence() {
     'sub_feature_types' => explode(',', $child),
     'relationship_type' => $relationship,
     'relationship_part' => $rel_part,
-    'width' => $width
-  );
+    'width' => $width,
+  ];
 
   $seqs = tripal_get_bulk_feature_sequences($options);
   if (count($seqs) == 0) {
-      print "No sequences found that match the criteria.";
+    print "No sequences found that match the criteria.";
   }
 
   foreach ($seqs as $seq) {

+ 9 - 9
legacy/tripal_feature/tripal_feature.views.inc

@@ -1,6 +1,6 @@
 <?php
 /**
- *  @file
+ * @file
  *  This file contains the basic functions for views integration of
  *  chado/tripal feature tables
  */
@@ -17,14 +17,14 @@
  * @ingroup tripal_legacy_feature
  */
 function tripal_feature_views_handlers() {
-  return array(
-    'info' => array(
+  return [
+    'info' => [
       'path' => drupal_get_path('module', 'tripal_feature') . '/views_handlers',
-    ),
-    'handlers' => array(
-      'views_handler_field_residues' => array(
+    ],
+    'handlers' => [
+      'views_handler_field_residues' => [
         'parent' => 'views_handler_field',
-      ),
-    ),
-  );
+      ],
+    ],
+  ];
 }

+ 82 - 82
legacy/tripal_feature/tripal_feature.views_default.inc

@@ -10,7 +10,7 @@
  * @ingroup tripal_legacy_feature
  */
 function tripal_feature_views_default_views() {
-  $views = array();
+  $views = [];
 
   // User View ("Search Biological Content")
   // Remember, if you change the name/path of this view, you also want to
@@ -60,7 +60,7 @@ function tripal_feature_defaultvalue_user_features() {
   $handler->display->display_options['pager']['options']['quantity'] = '9';
   $handler->display->display_options['style_plugin'] = 'table';
   $handler->display->display_options['style_options']['grouping'] = '';
-  $handler->display->display_options['style_options']['columns'] = array(
+  $handler->display->display_options['style_options']['columns'] = [
     'accession' => 'accession',
     'accession_link' => 'accession_link',
     'name' => 'name',
@@ -71,49 +71,49 @@ function tripal_feature_defaultvalue_user_features() {
     'is_obsolete' => 'is_obsolete',
     'is_analysis' => 'is_analysis',
     'nid' => 'nid',
-  );
+  ];
   $handler->display->display_options['style_options']['default'] = '-1';
-  $handler->display->display_options['style_options']['info'] = array(
-    'accession' => array(
+  $handler->display->display_options['style_options']['info'] = [
+    'accession' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'accession_link' => array(
+    ],
+    'accession_link' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'name' => array(
+    ],
+    'name' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'uniquename' => array(
+    ],
+    'uniquename' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'name_1' => array(
+    ],
+    'name_1' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'common_name' => array(
+    ],
+    'common_name' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'seqlen' => array(
+    ],
+    'seqlen' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'is_obsolete' => array(
+    ],
+    'is_obsolete' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'is_analysis' => array(
+    ],
+    'is_analysis' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'nid' => array(
+    ],
+    'nid' => [
       'separator' => '',
-    ),
-  );
+    ],
+  ];
   /* No results behavior: Global: Text area */
   $handler->display->display_options['empty']['text']['id'] = 'area';
   $handler->display->display_options['empty']['text']['table'] = 'views';
@@ -198,11 +198,11 @@ function tripal_feature_defaultvalue_user_features() {
   $handler->display->display_options['filters']['uniquename']['expose']['use_operator'] = TRUE;
   $handler->display->display_options['filters']['uniquename']['expose']['operator'] = 'uniquename_op';
   $handler->display->display_options['filters']['uniquename']['expose']['identifier'] = 'uniquename';
-  $handler->display->display_options['filters']['uniquename']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['uniquename']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
   $handler->display->display_options['filters']['uniquename']['select_optional'] = TRUE;
   $handler->display->display_options['filters']['uniquename']['max_length'] = '40';
   /* Filter criterion: Chado Feature: Name */
@@ -217,16 +217,16 @@ function tripal_feature_defaultvalue_user_features() {
   $handler->display->display_options['filters']['name_1']['expose']['use_operator'] = TRUE;
   $handler->display->display_options['filters']['name_1']['expose']['operator'] = 'name_1_op';
   $handler->display->display_options['filters']['name_1']['expose']['identifier'] = 'name';
-  $handler->display->display_options['filters']['name_1']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['name_1']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
   /* Filter criterion: Chado Feature: Type Id */
   $handler->display->display_options['filters']['type_id']['id'] = 'type_id';
   $handler->display->display_options['filters']['type_id']['table'] = 'feature';
   $handler->display->display_options['filters']['type_id']['field'] = 'type_id';
-  $handler->display->display_options['filters']['type_id']['value'] = array();
+  $handler->display->display_options['filters']['type_id']['value'] = [];
   $handler->display->display_options['filters']['type_id']['group'] = 1;
   $handler->display->display_options['filters']['type_id']['exposed'] = TRUE;
   $handler->display->display_options['filters']['type_id']['expose']['operator_id'] = 'type_id_op';
@@ -239,7 +239,7 @@ function tripal_feature_defaultvalue_user_features() {
   $handler->display->display_options['filters']['common_name']['id'] = 'common_name';
   $handler->display->display_options['filters']['common_name']['table'] = 'organism';
   $handler->display->display_options['filters']['common_name']['field'] = 'common_name';
-  $handler->display->display_options['filters']['common_name']['value'] = array();
+  $handler->display->display_options['filters']['common_name']['value'] = [];
   $handler->display->display_options['filters']['common_name']['group'] = 1;
   $handler->display->display_options['filters']['common_name']['exposed'] = TRUE;
   $handler->display->display_options['filters']['common_name']['expose']['operator_id'] = 'common_name_op';
@@ -297,7 +297,7 @@ function tripal_feature_defaultview_admin_features() {
   $handler->display->display_options['pager']['options']['quantity'] = '9';
   $handler->display->display_options['style_plugin'] = 'table';
   $handler->display->display_options['style_options']['grouping'] = '';
-  $handler->display->display_options['style_options']['columns'] = array(
+  $handler->display->display_options['style_options']['columns'] = [
     'accession' => 'accession',
     'accession_link' => 'accession_link',
     'name' => 'name',
@@ -308,93 +308,93 @@ function tripal_feature_defaultview_admin_features() {
     'is_obsolete' => 'is_obsolete',
     'is_analysis' => 'is_analysis',
     'nid' => 'nid',
-  );
+  ];
   $handler->display->display_options['style_options']['default'] = '-1';
-  $handler->display->display_options['style_options']['info'] = array(
-    'accession' => array(
+  $handler->display->display_options['style_options']['info'] = [
+    'accession' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'accession_link' => array(
+    ],
+    'accession_link' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'name' => array(
+    ],
+    'name' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'uniquename' => array(
+    ],
+    'uniquename' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'name_1' => array(
+    ],
+    'name_1' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'common_name' => array(
+    ],
+    'common_name' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'seqlen' => array(
+    ],
+    'seqlen' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'is_obsolete' => array(
+    ],
+    'is_obsolete' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'is_analysis' => array(
+    ],
+    'is_analysis' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'nid' => array(
+    ],
+    'nid' => [
       'separator' => '',
-    ),
-  );
+    ],
+  ];
   /* Header: Global: Action Links */
   $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
   $handler->display->display_options['header']['action_links_area']['table'] = 'views';
   $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
   $handler->display->display_options['header']['action_links_area']['label'] = 'Add/Import';
   $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
-  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+  $handler->display->display_options['header']['action_links_area']['link-1'] = [
     'label-1' => 'Add Feature',
     'path-1' => 'node/add/tripal-feature',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-2'] = [
     'label-2' => 'Import via FASTA file',
     'path-2' => 'admin/tripal/loaders/fasta_loader',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-3'] = [
     'label-3' => 'Import via GFF3 file',
     'path-3' => 'admin/tripal/loaders/gff3_load',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-4'] = [
     'label-4' => '',
     'path-4' => '',
-  );
+  ];
   /* Header: Global: Action Links */
   $handler->display->display_options['header']['action_links_area_1']['id'] = 'action_links_area_1';
   $handler->display->display_options['header']['action_links_area_1']['table'] = 'views';
   $handler->display->display_options['header']['action_links_area_1']['field'] = 'action_links_area';
   $handler->display->display_options['header']['action_links_area_1']['label'] = 'Extract';
   $handler->display->display_options['header']['action_links_area_1']['empty'] = TRUE;
-  $handler->display->display_options['header']['action_links_area_1']['link-1'] = array(
+  $handler->display->display_options['header']['action_links_area_1']['link-1'] = [
     'label-1' => 'Retrieve Sequences',
     'path-1' => 'find/sequences',
-  );
-  $handler->display->display_options['header']['action_links_area_1']['link-2'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area_1']['link-2'] = [
     'label-2' => '',
     'path-2' => '',
-  );
-  $handler->display->display_options['header']['action_links_area_1']['link-3'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area_1']['link-3'] = [
     'label-3' => '',
     'path-3' => '',
-  );
-  $handler->display->display_options['header']['action_links_area_1']['link-4'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area_1']['link-4'] = [
     'label-4' => '',
     'path-4' => '',
-  );
+  ];
   /* No results behavior: Global: Text area */
   $handler->display->display_options['empty']['text']['id'] = 'area';
   $handler->display->display_options['empty']['text']['table'] = 'views';
@@ -484,7 +484,7 @@ function tripal_feature_defaultview_admin_features() {
   $handler->display->display_options['filters']['common_name']['id'] = 'common_name';
   $handler->display->display_options['filters']['common_name']['table'] = 'organism';
   $handler->display->display_options['filters']['common_name']['field'] = 'common_name';
-  $handler->display->display_options['filters']['common_name']['value'] = array();
+  $handler->display->display_options['filters']['common_name']['value'] = [];
   $handler->display->display_options['filters']['common_name']['group'] = '0';
   $handler->display->display_options['filters']['common_name']['exposed'] = TRUE;
   $handler->display->display_options['filters']['common_name']['expose']['operator_id'] = 'common_name_op';
@@ -495,7 +495,7 @@ function tripal_feature_defaultview_admin_features() {
   $handler->display->display_options['filters']['type_id']['id'] = 'type_id';
   $handler->display->display_options['filters']['type_id']['table'] = 'feature';
   $handler->display->display_options['filters']['type_id']['field'] = 'type_id';
-  $handler->display->display_options['filters']['type_id']['value'] = array();
+  $handler->display->display_options['filters']['type_id']['value'] = [];
   $handler->display->display_options['filters']['type_id']['group'] = '0';
   $handler->display->display_options['filters']['type_id']['exposed'] = TRUE;
   $handler->display->display_options['filters']['type_id']['expose']['operator_id'] = 'type_id_op';
@@ -536,15 +536,15 @@ function tripal_feature_defaultview_admin_features() {
   $handler->display->display_options['tab_options']['weight'] = '0';
 
   /** MANUALLY ADD since filter handler no exporting correctly
-  $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'select';
-  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
-  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
-  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
-  $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
-  $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
-  $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
-  $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
-  */
+   * $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'select';
+   * $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+   * $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
+   * $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+   * $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
+   * $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
+   * $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
+   * $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
+   */
 
   return $view;
 }

+ 4 - 1
legacy/tripal_feature/views_handlers/views_handler_field_residues.inc

@@ -17,7 +17,10 @@ class views_handler_field_residues extends views_handler_field {
    */
   function construct() {
     parent::construct();
-    $this->additional_fields['residues'] = array('table' => 'feature', 'field' => 'residues');
+    $this->additional_fields['residues'] = [
+      'table' => 'feature',
+      'field' => 'residues',
+    ];
   }
 
   /**

+ 70 - 69
legacy/tripal_featuremap/api/tripal_featuremap.DEPRECATED.inc

@@ -1,13 +1,14 @@
 <?php
 /**
  * @file
- * Wrapper functions to provide backwards compatibility for the tripal featuremap api
+ * Wrapper functions to provide backwards compatibility for the tripal
+ *   featuremap api
  */
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_get_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_get_property().
  *
  * @see chado_get_property().
  */
@@ -17,26 +18,26 @@ function tripal_featuremap_get_property($featuremap_id, $property) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_featuremap_get_property',
-      '%new_function' => 'chado_get_property'
-    )
+    [
+      '%old_function' => 'tripal_featuremap_get_property',
+      '%new_function' => 'chado_get_property',
+    ]
   );
-  $record = array(
+  $record = [
     'table' => 'featuremap',
     'id' => $featuremap_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => 'featuremap_property',
-  );
+  ];
   return chado_get_property($record, $property);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_insert_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_insert_property().
  *
  * @see chado_insert_property().
  */
@@ -46,30 +47,30 @@ function tripal_featuremap_insert_property($featuremap_id, $property, $value, $u
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_featuremap_insert_property',
-      '%new_function' => 'chado_insert_property'
-    )
+    [
+      '%old_function' => 'tripal_featuremap_insert_property',
+      '%new_function' => 'chado_insert_property',
+    ]
   );
-  $record = array(
+  $record = [
     'table' => 'featuremap',
     'id' => $featuremap_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => 'featuremap_property',
     'value' => $value,
-  );
-  $options = array(
+  ];
+  $options = [
     'update_if_present' => $update_if_present,
-  );
+  ];
   return chado_insert_property($record, $property, $options);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_update_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_update_property().
  *
  * @see chado_update_property().
  */
@@ -79,30 +80,30 @@ function tripal_featuremap_update_property($featuremap_id, $property, $value, $i
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_featuremap_update_property',
-      '%new_function' => 'chado_update_property'
-    )
+    [
+      '%old_function' => 'tripal_featuremap_update_property',
+      '%new_function' => 'chado_update_property',
+    ]
   );
-  $record = array(
+  $record = [
     'table' => 'featuremap',
     'id' => $featuremap_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => 'featuremap_property',
     'value' => $value,
-  );
-  $options = array(
+  ];
+  $options = [
     'insert_if_missing' => $insert_if_missing,
-  );
+  ];
   return chado_update_property($record, $property, $options);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_delete_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_delete_property().
  *
  * @see chado_delete_property().
  */
@@ -112,28 +113,28 @@ function tripal_featuremap_delete_property($featuremap_id, $property) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_featuremap_delete_property',
-      '%new_function' => 'chado_delete_property'
-    )
+    [
+      '%old_function' => 'tripal_featuremap_delete_property',
+      '%new_function' => 'chado_delete_property',
+    ]
   );
-  
-  $record = array(
+
+  $record = [
     'table' => 'featuremap',
     'id' => $featuremap_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => 'featuremap_property',
-  );
+  ];
 
   return chado_delete_property($record, $property);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_associate_dbxref().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_associate_dbxref().
  *
  * @see chado_associate_dbxref().
  */
@@ -143,16 +144,16 @@ function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbx
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_featuremap_add_featuremap_dbxref',
-      '%new_function' => 'chado_associate_dbxref'
-    )
+    [
+      '%old_function' => 'tripal_featuremap_add_featuremap_dbxref',
+      '%new_function' => 'chado_associate_dbxref',
+    ]
   );
 
   // break apart the dbxref
   $dbname = '';
   $accession = '';
-  if(preg_match('/^(.*?):(.*?)$/', $featuremap_dbxref, $matches)) {
+  if (preg_match('/^(.*?):(.*?)$/', $featuremap_dbxref, $matches)) {
     $dbname = $matches[1];
     $accession = $matches[2];
   }
@@ -161,20 +162,20 @@ function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbx
   }
 
   // check to see if the featuremap_dbxref record already exist
-  $values = array(
-    'dbxref_id' => array(
+  $values = [
+    'dbxref_id' => [
       'accession' => $accession,
-      'db_id' => array(
+      'db_id' => [
         'name' => $dbname,
-      ),
-    ),
+      ],
+    ],
     'featuremap_id' => $featuremap_id,
-  );
-  $options = array('statement_name' => 'sel_featuremapdbxref_dbpu');
-  $results = chado_select_record('featuremap_dbxref', array('*'), $values, $options);
+  ];
+  $options = ['statement_name' => 'sel_featuremapdbxref_dbpu'];
+  $results = chado_select_record('featuremap_dbxref', ['*'], $values, $options);
 
   // if the featuremap_dbxref record  exist then we don't need to re-add it.
-  if(count($results) > 0) {
+  if (count($results) > 0) {
     return $results[0];
   }
 
@@ -182,14 +183,14 @@ function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbx
   $db = tripal_db_add_db($dbname);
 
   // get the database cross-reference
-  $dbxvalues = array(
+  $dbxvalues = [
     'accession' => $accession,
     'db_id' => $db->db_id,
-  );
-  $dbxoptions = array('statement_name' => 'sel_dbxref_acdb');
-  $results = chado_select_record('dbxref', array('dbxref_id'), $dbxvalues, $dbxoptions);
+  ];
+  $dbxoptions = ['statement_name' => 'sel_dbxref_acdb'];
+  $results = chado_select_record('dbxref', ['dbxref_id'], $dbxvalues, $dbxoptions);
   // if the accession doesn't exist then add it
-  if(count($results) == 0){
+  if (count($results) == 0) {
     $dbxref = tripal_db_add_dbxref($db->db_id, $accession);
   }
   else {
@@ -197,11 +198,11 @@ function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbx
   }
 
   // now add the record
-  $options = array('statement_name' => 'ins_featuremapdbxref_dbpu');
+  $options = ['statement_name' => 'ins_featuremapdbxref_dbpu'];
   $results = chado_insert_record('featuremap_dbxref', $values, $options);
   if (!$results) {
     tripal_report_error('t_featuremap', TRIPAL_ERROR, "Cannot add map dbxref: %db:%accession.",
-      array('%db' => $dbname, '%accession' => $accession));
+      ['%db' => $dbname, '%accession' => $accession]);
     return FALSE;
   }
   return $results;

+ 22 - 20
legacy/tripal_featuremap/includes/tripal_featuremap.admin.inc

@@ -13,7 +13,7 @@ function tripal_featuremap_admin_featuremaps_listing() {
   $output = '';
 
   // set the breadcrumb
-  $breadcrumb = array();
+  $breadcrumb = [];
   $breadcrumb[] = l('Home', '<front>');
   $breadcrumb[] = l('Administration', 'admin');
   $breadcrumb[] = l('Tripal', 'admin/tripal');
@@ -22,7 +22,7 @@ function tripal_featuremap_admin_featuremaps_listing() {
   drupal_set_breadcrumb($breadcrumb);
 
   // Add the view
-  $view = views_embed_view('tripal_featuremap_admin_featuremaps','default');
+  $view = views_embed_view('tripal_featuremap_admin_featuremaps', 'default');
   if (isset($view)) {
     $output .= $view;
   }
@@ -32,7 +32,7 @@ function tripal_featuremap_admin_featuremaps_listing() {
       . 'administrative interface are disabled. <strong>Click each of the following links to '
       . 'enable the pertinent views</strong>:</p>';
     $output .= '<ul>';
-      $output .= '<li>'.l('Feature Map Admin', 'admin/tripal/legacy/tripal_featuremap/views/featuremaps/enable').'</li>';
+    $output .= '<li>' . l('Feature Map Admin', 'admin/tripal/legacy/tripal_featuremap/views/featuremaps/enable') . '</li>';
     $output .= '</ul>';
   }
 
@@ -45,35 +45,37 @@ function tripal_featuremap_admin_featuremaps_listing() {
  * @ingroup tripal_legacy_featuremap
  */
 function tripal_featuremap_admin() {
-  $form = array();
+  $form = [];
 
   // If your module is using the Chado Node: Title & Path API to allow custom titles
   // for your node type then you need to add the configuration form for this functionality.
-  $details = array(
-    'module' => 'tripal_featuremap',       // the name of the MODULE implementing the content type
-    'content_type' => 'chado_featuremap',   // the name of the content type
-      // An array of options to use under "Page Titles"
-      // the key should be the token and the value should be the human-readable option
-    'options' => array(
-        // there should always be one options matching the unique constraint.
-      '[featuremap.name]' => 'Unique Contraint: The name of the map'
-    ),
+  $details = [
+    'module' => 'tripal_featuremap',
+    // the name of the MODULE implementing the content type
+    'content_type' => 'chado_featuremap',
+    // the name of the content type
+    // An array of options to use under "Page Titles"
+    // the key should be the token and the value should be the human-readable option
+    'options' => [
+      // there should always be one options matching the unique constraint.
+      '[featuremap.name]' => 'Unique Contraint: The name of the map',
+    ],
     // the token indicating the unique constraint in the options array
-    'unique_option' => '[featuremap.name]'
-  );
+    'unique_option' => '[featuremap.name]',
+  ];
   // This call adds the configuration form to your current form
   // This sub-form handles it's own validation & submit
   chado_add_admin_form_set_title($form, $form_state, $details);
 
   // URL ALIAS
-  $details = array(
+  $details = [
     'module' => 'tripal_featuremap',
     'content_type' => 'chado_featuremap',
-    'options' => array(
+    'options' => [
       '/featuremap/[featuremap.featuremap_id]' => 'Feature Map ID',
-      '/featuremap/[featuremap.name]' => 'Unique Contraint: The name of the Feature Map'
-    ),
-  );
+      '/featuremap/[featuremap.name]' => 'Unique Contraint: The name of the Feature Map',
+    ],
+  ];
 
   // This call adds the configuration form to your current form
   // This sub-form handles it's own validation & submit

+ 149 - 133
legacy/tripal_featuremap/includes/tripal_featuremap.chado_node.inc

@@ -13,26 +13,26 @@
  * @ingroup tripal_legacy_featuremap
  */
 function tripal_featuremap_node_info() {
-  $nodes = array();
-  $nodes['chado_featuremap'] = array(
-    'name'        => t('Feature Map (Tripal v2 legacy)'),
-    'base'        => 'chado_featuremap',
+  $nodes = [];
+  $nodes['chado_featuremap'] = [
+    'name' => t('Feature Map (Tripal v2 legacy)'),
+    'base' => 'chado_featuremap',
     'description' => t('A map of features from the chado database (e.g. genetic map)'),
-    'has_title'   => TRUE,
-    'locked'      => TRUE,
-    'chado_node_api' => array(
+    'has_title' => TRUE,
+    'locked' => TRUE,
+    'chado_node_api' => [
       'base_table' => 'featuremap',
       'hook_prefix' => 'chado_featuremap',
-      'record_type_title' => array(
+      'record_type_title' => [
         'singular' => t('Feature Map'),
-        'plural' => t('Feature Maps')
-      ),
-      'sync_filters' => array(
+        'plural' => t('Feature Maps'),
+      ],
+      'sync_filters' => [
         'type_id' => FALSE,
-        'organism_id' => FALSE
-      ),
-    )
-  );
+        'organism_id' => FALSE,
+      ],
+    ],
+  ];
   return $nodes;
 }
 
@@ -43,7 +43,7 @@ function tripal_featuremap_node_info() {
  * @ingroup tripal_legacy_featuremap
  */
 function chado_featuremap_form($node, &$form_state) {
-  $form = array();
+  $form = [];
 
   // Default values can come in the following ways:
   //
@@ -66,82 +66,85 @@ function chado_featuremap_form($node, &$form_state) {
     $featuremap_id = $featuremap->featuremap_id;
 
     // get form defaults
-    $fmapname    = $featuremap->name;
+    $fmapname = $featuremap->name;
     $description = $featuremap->description;
     $unittype_id = $featuremap->unittype_id->cvterm_id;
 
     // set the featuremap_id in the form
-    $form['featuremap_id'] = array(
+    $form['featuremap_id'] = [
       '#type' => 'hidden',
       '#value' => $featuremap_id,
-    );
+    ];
   }
   // if we are re constructing the form from a failed validation or ajax callback
   // then use the $form_state['values'] values
   if (array_key_exists('values', $form_state)) {
-    $fmapname       = $form_state['values']['fmapname'];
+    $fmapname = $form_state['values']['fmapname'];
     $description = $form_state['values']['description'];
     $unittype_id = $form_state['values']['unittype_id'];
   }
   // if we are re building the form from after submission (from ajax call) then
   // the values are in the $form_state['input'] array
   if (array_key_exists('input', $form_state) and !empty($form_state['input'])) {
-    $fmapname       = $form_state['input']['fmapname'];
+    $fmapname = $form_state['input']['fmapname'];
     $description = $form_state['input']['description'];
     $unittype_id = $form_state['input']['unittype_id'];
   }
 
-  $form['fmapname']= array(
-    '#type'          => 'textfield',
-    '#title'         => t('Map Name'),
-    '#description'   => t('Please enter a name for this map'),
-    '#required'      => TRUE,
+  $form['fmapname'] = [
+    '#type' => 'textfield',
+    '#title' => t('Map Name'),
+    '#description' => t('Please enter a name for this map'),
+    '#required' => TRUE,
     '#default_value' => $fmapname,
-    '#maxlength'     => 255
-  );
-  $form['description']= array(
-    '#type'          => 'text_format',
-    '#title'         => t('Map Description'),
-    '#description'   => t('A description of the map.'),
-    '#required'      => TRUE,
+    '#maxlength' => 255,
+  ];
+  $form['description'] = [
+    '#type' => 'text_format',
+    '#title' => t('Map Description'),
+    '#description' => t('A description of the map.'),
+    '#required' => TRUE,
     '#default_value' => $description,
-  );
+  ];
 
   // get the list of unit types
   $units = tripal_get_cvterm_default_select_options('featuremap', 'unittype_id', 'map unit types');
 
-  $form['unittype_id'] = array(
-    '#title'       => t('Map Units'),
-    '#type'        => t('select'),
+  $form['unittype_id'] = [
+    '#title' => t('Map Units'),
+    '#type' => t('select'),
     '#description' => t("Chose the units for this map"),
-    '#required'    => TRUE,
+    '#required' => TRUE,
     '#default_value' => $unittype_id,
-    '#options'     => $units,
-  );
+    '#options' => $units,
+  ];
 
   // Properties Form
   // ----------------------------------
   $prop_cv = tripal_get_default_cv('featuremap_property', 'type_id');
   $cv_id = $prop_cv ? $prop_cv->cv_id : NULL;
   $instructions = t('To add additional properties to the drop down. ' . l("Add terms to the featuremap_property vocabulary", "admin/tripal/vocab/cvterm/add") . ".");
-  $details = array(
+  $details = [
     'property_table' => 'featuremapprop',
     'chado_id' => $featuremap_id,
     'cv_id' => $cv_id,
     'fieldset_name' => 'Additional Details',
-    'additional_instructions' => $instructions
-  );
+    'additional_instructions' => $instructions,
+  ];
   // TODO: remove the 'Map Dbxref' from the list as that should now be handled
   // by the dbxref interface below
   chado_add_node_form_properties($form, $form_state, $details);
 
   // ADDITIONAL DBXREFS FORM
   //---------------------------------------------
-  $details = array(
-    'linking_table' => 'featuremap_dbxref',  // the name of the _dbxref table
-    'base_foreign_key' => 'featuremap_id',   // the name of the key in your base chado table
-    'base_key_value' => $featuremap_id       // the value of featuremap_id for this record
-  );
+  $details = [
+    'linking_table' => 'featuremap_dbxref',
+    // the name of the _dbxref table
+    'base_foreign_key' => 'featuremap_id',
+    // the name of the key in your base chado table
+    'base_key_value' => $featuremap_id
+    // the value of featuremap_id for this record
+  ];
   // Adds the form elements to your current form
   chado_add_node_form_dbxrefs($form, $form_state, $details);
 
@@ -159,7 +162,7 @@ function chado_featuremap_validate($node, $form, &$form_state) {
   // Since this validate can be called on AJAX and Deletion of the node
   // we need to make this check to ensure queries are not executed
   // without the proper values.
-  if(property_exists($node, "op") and $node->op != 'Save') {
+  if (property_exists($node, "op") and $node->op != 'Save') {
     return;
   }
 
@@ -187,11 +190,14 @@ function chado_featuremap_validate($node, $form, &$form_state) {
       SELECT * FROM {featuremap}
       WHERE name = :name AND NOT featuremap_id = :featuremap_id
     ";
-    $featuremap = chado_query($sql, array(':name' => $node->fmapname, ':featuremap_id' => $node->featuremap_id))->fetchObject();
+    $featuremap = chado_query($sql, [
+      ':name' => $node->fmapname,
+      ':featuremap_id' => $node->featuremap_id,
+    ])->fetchObject();
   }
   else {
     $sql = "SELECT * FROM {featuremap} WHERE name = :name";
-    $featuremap = chado_query($sql, array(':name' => $node->fmapname))->fetchObject();
+    $featuremap = chado_query($sql, [':name' => $node->fmapname])->fetchObject();
   }
   if ($featuremap) {
     form_set_error('fmapname', t('The unique map name already exists. Please choose another'));
@@ -203,21 +209,22 @@ function chado_featuremap_validate($node, $form, &$form_state) {
  *
  * This hook allows node modules to limit access to the node types they define.
  *
- *  @param $node
- *  The node on which the operation is to be performed, or, if it does not yet exist, the
- *  type of node to be created
+ * @param $node
+ *  The node on which the operation is to be performed, or, if it does not yet
+ *   exist, the type of node to be created
  *
- *  @param $op
+ * @param $op
  *  The operation to be performed
  *
- *  @param $account
- *  A user object representing the user for whom the operation is to be performed
+ * @param $account
+ *  A user object representing the user for whom the operation is to be
+ *   performed
  *
- *  @return
- *  If the permission for the specified operation is not set then return FALSE. If the
- *  permission is set then return NULL as this allows other modules to disable
- *  access.  The only exception is when the $op == 'create'.  We will always
- *  return TRUE if the permission is set.
+ * @return
+ *  If the permission for the specified operation is not set then return FALSE.
+ *   If the permission is set then return NULL as this allows other modules to
+ *   disable access.  The only exception is when the $op == 'create'.  We will
+ *   always return TRUE if the permission is set.
  *
  * @ingroup tripal_legacy_featuremap
  */
@@ -227,7 +234,7 @@ function tripal_featuremap_node_access($node, $op, $account) {
     $node_type = $node->type;
   }
 
-  if($node_type == 'chado_featuremap') {
+  if ($node_type == 'chado_featuremap') {
     if ($op == 'create') {
       if (!user_access('create chado_featuremap content', $account)) {
         return NODE_ACCESS_DENY;
@@ -257,8 +264,8 @@ function tripal_featuremap_node_access($node, $op, $account) {
  * Implements hook_insert().
  *
  * When a new chado_featuremap node is created we also need to add information
- *  to our chado_featuremap table.  This function is called on insert of a new node
- *  of type 'chado_featuremap' and inserts the necessary information.
+ *  to our chado_featuremap table.  This function is called on insert of a new
+ * node of type 'chado_featuremap' and inserts the necessary information.
  *
  * @ingroup tripal_legacy_featuremap
  */
@@ -272,18 +279,18 @@ function chado_featuremap_insert($node) {
   if (!property_exists($node, 'featuremap_id')) {
 
     $node->fmapname = trim($node->fmapname);
-    $node->description  = trim($node->description['value']);
+    $node->description = trim($node->description['value']);
 
-    $values = array(
-      'name'        => $node->fmapname,
+    $values = [
+      'name' => $node->fmapname,
       'description' => $node->description,
-      'unittype_id' => $node->unittype_id
-    );
+      'unittype_id' => $node->unittype_id,
+    ];
     $featuremap = chado_insert_record('featuremap', $values);
-    if(!$featuremap) {
+    if (!$featuremap) {
       drupal_set_message(t('Unable to add featuremap.', 'warning'));
       tripal_report_error('tripal_featuremap', TRIPAL_WARNING, 'Unable to create feature map where values: %values',
-      array('%values' => print_r($values, TRUE)));
+        ['%values' => print_r($values, TRUE)]);
       return;
     }
     $featuremap_id = $featuremap['featuremap_id'];
@@ -293,8 +300,8 @@ function chado_featuremap_insert($node) {
     // We need to deal with the 'Map Dbxref' property specially
     $cvterm = chado_select_record(
       'cvterm',
-      array('cvterm_id'),
-      array('name' => 'Map Dbxref', 'cv_id' => array('name' => 'featuremap_property'))
+      ['cvterm_id'],
+      ['name' => 'Map Dbxref', 'cv_id' => ['name' => 'featuremap_property']]
     );
     $map_dbxref_cvterm_id = $cvterm[0]->cvterm_id;
     if (isset($properties[$map_dbxref_cvterm_id])) {
@@ -303,25 +310,28 @@ function chado_featuremap_insert($node) {
         if (!$featuremap_dbxref) {
           drupal_set_message("Error cannot add featuremap cross reference: $value", "error");
           tripal_report_error('t_featuremap', TRIPAL_ERROR, "Error cannot add featuremap cross reference: %ref",
-          array('%ref' => $value));
+            ['%ref' => $value]);
         }
       }
       unset($properties[$map_dbxref_cvterm_id]);
     }
-    $details = array(
+    $details = [
       'property_table' => 'featuremapprop',
       'base_table' => 'featuremap',
       'foreignkey_name' => 'featuremap_id',
-      'foreignkey_value' => $featuremap_id
-    );
+      'foreignkey_value' => $featuremap_id,
+    ];
     chado_update_node_form_properties($node, $details, $properties);
 
     // * Additional DBxrefs Form *
-    $details = array(
-      'linking_table' => 'featuremap_dbxref',   // the name of your _dbxref table
-      'foreignkey_name' => 'featuremap_id',     // the name of the key in your base table
-      'foreignkey_value' => $featuremap_id      // the value of the featuremap_id key
-    );
+    $details = [
+      'linking_table' => 'featuremap_dbxref',
+      // the name of your _dbxref table
+      'foreignkey_name' => 'featuremap_id',
+      // the name of the key in your base table
+      'foreignkey_value' => $featuremap_id
+      // the value of the featuremap_id key
+    ];
     chado_update_node_form_dbxrefs($node, $details);
 
   }
@@ -348,24 +358,24 @@ function chado_featuremap_insert($node) {
  */
 function chado_featuremap_update($node) {
 
-  $node->fmapname  = trim($node->fmapname);
-  $node->description  = trim($node->description['value']);
+  $node->fmapname = trim($node->fmapname);
+  $node->description = trim($node->description['value']);
 
-  $featuremap_id = chado_get_id_from_nid('featuremap', $node->nid) ;
+  $featuremap_id = chado_get_id_from_nid('featuremap', $node->nid);
 
   // update the map record
-  $match = array(
+  $match = [
     'featuremap_id' => $featuremap_id,
-  );
-  $values = array(
+  ];
+  $values = [
     'name' => $node->fmapname,
     'description' => $node->description,
-    'unittype_id' => $node->unittype_id
-  );
+    'unittype_id' => $node->unittype_id,
+  ];
   $status = chado_update_record('featuremap', $match, $values);
   if (!$status) {
     drupal_set_message("Error updating map", "error");
-    tripal_report_error('t_featuremap', TRIPAL_ERROR, "Error updating map", array());
+    tripal_report_error('t_featuremap', TRIPAL_ERROR, "Error updating map", []);
     return;
   }
 
@@ -374,8 +384,8 @@ function chado_featuremap_update($node) {
   // We need to deal with the 'Map Dbxref' property specially
   $cvterm = chado_select_record(
     'cvterm',
-    array('cvterm_id'),
-    array('name' => 'Map Dbxref', 'cv_id' => array('name' => 'featuremap_property'))
+    ['cvterm_id'],
+    ['name' => 'Map Dbxref', 'cv_id' => ['name' => 'featuremap_property']]
   );
   $map_dbxref_cvterm_id = $cvterm[0]->cvterm_id;
   if (isset($properties[$map_dbxref_cvterm_id])) {
@@ -384,25 +394,28 @@ function chado_featuremap_update($node) {
       if (!$featuremap_dbxref) {
         drupal_set_message("Error cannot add featuremap cross reference: $value", "error");
         tripal_report_error('t_featuremap', TRIPAL_ERROR, "Error cannot add featuremap cross reference: %ref",
-        array('%ref' => $value));
+          ['%ref' => $value]);
       }
     }
     unset($properties[$map_dbxref_cvterm_id]);
   }
-  $details = array(
+  $details = [
     'property_table' => 'featuremapprop',
     'base_table' => 'featuremap',
     'foreignkey_name' => 'featuremap_id',
-    'foreignkey_value' => $featuremap_id
-  );
+    'foreignkey_value' => $featuremap_id,
+  ];
   chado_update_node_form_properties($node, $details, $properties);
 
   // * Additional DBxrefs Form *
-  $details = array(
-    'linking_table' => 'featuremap_dbxref',   // the name of your _dbxref table
-    'foreignkey_name' => 'featuremap_id',     // the name of the key in your base table
-    'foreignkey_value' => $featuremap_id      // the value of the featuremap_id key
-  );
+  $details = [
+    'linking_table' => 'featuremap_dbxref',
+    // the name of your _dbxref table
+    'foreignkey_name' => 'featuremap_id',
+    // the name of the key in your base table
+    'foreignkey_value' => $featuremap_id
+    // the value of the featuremap_id key
+  ];
   chado_update_node_form_dbxrefs($node, $details);
 
 }
@@ -426,7 +439,7 @@ function chado_featuremap_load($nodes) {
       continue;
     }
 
-    $values = array('featuremap_id' => $featuremap_id);
+    $values = ['featuremap_id' => $featuremap_id];
     $featuremap = chado_generate_var('featuremap', $values);
 
     // expand the description field as it is needed by the form
@@ -444,6 +457,7 @@ function chado_featuremap_load($nodes) {
  * Implements hook_delete().
  *
  * Delete data from drupal and chado databases when a node is deleted
+ *
  * @ingroup tripal_legacy_featuremap
  */
 function chado_featuremap_delete(&$node) {
@@ -459,16 +473,16 @@ function chado_featuremap_delete(&$node) {
   // Remove data from {chado_featuremap}, {node} and {node_revisions} tables of
   // drupal database
   $sql_del = "DELETE FROM {chado_featuremap} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
   $sql_del = "DELETE FROM {node_revision} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
   $sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
 
   // Remove data from map and mapprop tables of chado database as well
-  chado_query("DELETE FROM {featuremapprop}    WHERE featuremap_id = :featuremap_id", array(':featuremap_id' => $featuremap_id));
-  chado_query("DELETE FROM {featuremap_dbxref} WHERE featuremap_id = :featuremap_id", array(':featuremap_id' => $featuremap_id));
-  chado_query("DELETE FROM {featuremap}        WHERE featuremap_id = :featuremap_id", array(':featuremap_id' => $featuremap_id));
+  chado_query("DELETE FROM {featuremapprop}    WHERE featuremap_id = :featuremap_id", [':featuremap_id' => $featuremap_id]);
+  chado_query("DELETE FROM {featuremap_dbxref} WHERE featuremap_id = :featuremap_id", [':featuremap_id' => $featuremap_id]);
+  chado_query("DELETE FROM {featuremap}        WHERE featuremap_id = :featuremap_id", [':featuremap_id' => $featuremap_id]);
 
 }
 
@@ -492,8 +506,10 @@ function tripal_featuremap_node_presave($node) {
         // set the title
         $node->title = $node->fmapname;
       }
-      else if (property_exists($node, 'featuremap')) {
-        $node->title = $node->featuremap->name;
+      else {
+        if (property_exists($node, 'featuremap')) {
+          $node->title = $node->featuremap->name;
+        }
       }
       break;
   }
@@ -509,53 +525,53 @@ function tripal_featuremap_node_view($node, $view_mode, $langcode) {
     case 'chado_featuremap':
       // Show feature browser and counts
       if ($view_mode == 'full') {
-        $node->content['tripal_featuremap_base'] = array(
+        $node->content['tripal_featuremap_base'] = [
           '#theme' => 'tripal_featuremap_base',
           '#node' => $node,
-          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_id' => 'base',
           '#tripal_toc_title' => 'Overview',
           '#weight' => -100,
-        );
-        $node->content['tripal_featuremap_featurepos'] = array(
+        ];
+        $node->content['tripal_featuremap_featurepos'] = [
           '#theme' => 'tripal_featuremap_featurepos',
           '#node' => $node,
-          '#tripal_toc_id'    => 'featurepos',
+          '#tripal_toc_id' => 'featurepos',
           '#tripal_toc_title' => 'Map Features',
-        );
-        $node->content['tripal_featuremap_properties'] = array(
+        ];
+        $node->content['tripal_featuremap_properties'] = [
           '#theme' => 'tripal_featuremap_properties',
           '#node' => $node,
-          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_id' => 'properties',
           '#tripal_toc_title' => 'Properties',
-        );
-        $node->content['tripal_featuremap_publication'] = array(
+        ];
+        $node->content['tripal_featuremap_publication'] = [
           '#theme' => 'tripal_featuremap_publication',
           '#node' => $node,
-          '#tripal_toc_id'    => 'publications',
+          '#tripal_toc_id' => 'publications',
           '#tripal_toc_title' => 'Publications',
-        );
-        $node->content['tripal_featuremap_references'] = array(
+        ];
+        $node->content['tripal_featuremap_references'] = [
           '#theme' => 'tripal_featuremap_references',
           '#node' => $node,
-          '#tripal_toc_id'    => 'references',
+          '#tripal_toc_id' => 'references',
           '#tripal_toc_title' => 'Cross References',
-        );
+        ];
       }
       if ($view_mode == 'teaser') {
-        $node->content['tripal_featuremap_teaser'] = array(
+        $node->content['tripal_featuremap_teaser'] = [
           '#theme' => 'tripal_featuremap_teaser',
           '#node' => $node,
-        );
+        ];
       }
       break;
     case 'chado_feature':
       if ($view_mode == 'full') {
-        $node->content['tripal_feature_featurepos'] = array(
+        $node->content['tripal_feature_featurepos'] = [
           '#theme' => 'tripal_feature_featurepos',
           '#node' => $node,
-          '#tripal_toc_id'    => 'featurepos',
+          '#tripal_toc_id' => 'featurepos',
           '#tripal_toc_title' => 'Maps',
-        );
+        ];
       }
       break;
   }
@@ -574,7 +590,7 @@ function tripal_featuremap_node_insert($node) {
 
       // get the feature details from chado
       $featuremap_id = chado_get_id_from_nid('featuremap', $node->nid);
-      $values = array('featuremap_id' => $featuremap_id);
+      $values = ['featuremap_id' => $featuremap_id];
       $featuremap = chado_generate_var('featuremap', $values);
       $node->featuremap = $featuremap;
 

+ 49 - 47
legacy/tripal_featuremap/theme/templates/tripal_feature_featurepos.tpl.php

@@ -7,25 +7,25 @@ $featurepos_pager_id = 20;
 
 // get the maps associated with this feature
 $feature = $variables['node']->feature;
-$options = array(
+$options = [
   'return_array' => 1,
-  'order_by' => array(
-    'map_feature_id' => 'ASC'
-  ),
-  'pager' => array(
+  'order_by' => [
+    'map_feature_id' => 'ASC',
+  ],
+  'pager' => [
     'limit' => $num_results_per_page,
-    'element' => $featurepos_pager_id
-  ),
-  'include_fk' => array(
-    'map_feature_id' => array(
+    'element' => $featurepos_pager_id,
+  ],
+  'include_fk' => [
+    'map_feature_id' => [
       'type_id' => 1,
       'organism_id' => 1,
-    ),
-    'featuremap_id' => array(
-       'unittype_id' => 1,
-    ),
-  ),
-);
+    ],
+    'featuremap_id' => [
+      'unittype_id' => 1,
+    ],
+  ],
+];
 
 $feature = chado_expand_var($feature, 'table', 'featurepos', $options);
 
@@ -38,44 +38,46 @@ $map_positions = $feature->featurepos->map_feature_id;
 $total_records = chado_pager_get_count($featurepos_pager_id);
 
 
-if(count($map_positions) > 0){ ?>
-  <div class="tripal_feature-data-block-desc tripal-data-block-desc">This feature is contained in the following <?php print number_format($total_records) ?> map(s):</div><?php
+if (count($map_positions) > 0) { ?>
+    <div class="tripal_feature-data-block-desc tripal-data-block-desc">This
+    feature is contained in the
+    following <?php print number_format($total_records) ?> map(s):</div><?php
 
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Map Name', 'Landmark', 'Type', 'Position');
+  $headers = ['Map Name', 'Landmark', 'Type', 'Position'];
 
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
+  $rows = [];
 
   // iterate through our map positions
-  foreach ($map_positions as $position){
+  foreach ($map_positions as $position) {
     $map_feature = $position->map_feature_id;
 
     // check if there are any values in the featureposprop table for the start and stop
     $mappos = $position->mappos;
-    $options = array(
+    $options = [
       'return_array' => 1,
-      'include_fk' => array(
+      'include_fk' => [
         'type_id' => 1,
-      ),
-    );
+      ],
+    ];
     $position = chado_expand_var($position, 'table', 'featureposprop', $options);
     $featureposprop = $position->featureposprop;
     $start = '';
     $stop = '';
     if (is_array($featureposprop)) {
       foreach ($featureposprop as $index => $property) {
-         if ($property->type_id->name == 'start') {
-           $start = $property->value;
-         }
-         if ($property->type_id->name == 'stop') {
-           $stop = $property->value;
-         }
+        if ($property->type_id->name == 'start') {
+          $start = $property->value;
+        }
+        if ($property->type_id->name == 'stop') {
+          $stop = $property->value;
+        }
       }
     }
     if ($start and $stop and $start != $stop) {
@@ -89,41 +91,41 @@ if(count($map_positions) > 0){ ?>
     }
 
     // get the map name feature
-    $map_name =  $position->featuremap_id->name;
+    $map_name = $position->featuremap_id->name;
     if (property_exists($position->featuremap_id, 'nid')) {
-      $map_name = l($map_name, 'node/' . $position->featuremap_id->nid, array('attributes' => array('target' => '_blank')));
+      $map_name = l($map_name, 'node/' . $position->featuremap_id->nid, ['attributes' => ['target' => '_blank']]);
     }
 
 
     // get the landmark
     $landmark = $map_feature->name;
     if (property_exists($map_feature, 'nid')) {
-      $landmark =  l($landmark, 'node/' . $map_feature->nid, array('attributes' => array('target' => '_blank')));
+      $landmark = l($landmark, 'node/' . $map_feature->nid, ['attributes' => ['target' => '_blank']]);
     }
 
-    $rows[] = array(
+    $rows[] = [
       $map_name,
       $landmark,
       $map_feature->type_id->name,
       $mappos . ' ' . $position->featuremap_id->unittype_id->name,
-    );
+    ];
   }
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_feature-table-featurepos',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
+  ];
 
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
@@ -139,14 +141,14 @@ if(count($map_positions) > 0){ ?>
   // Drupal won't reset the parameter if it already exists.
   $get = $_GET;
   unset($_GET['pane']);
-  $pager = array(
-    'tags' => array(),
+  $pager = [
+    'tags' => [],
     'element' => $featurepos_pager_id,
-    'parameters' => array(
-      'pane' => 'featurepos'
-    ),
+    'parameters' => [
+      'pane' => 'featurepos',
+    ],
     'quantity' => $num_results_per_page,
-  );
+  ];
   print theme_pager($pager);
   $_GET = $get;
 }

+ 28 - 28
legacy/tripal_featuremap/theme/templates/tripal_featuremap_base.tpl.php

@@ -1,78 +1,78 @@
 <?php
 
-$featuremap  = $variables['node']->featuremap;
+$featuremap = $variables['node']->featuremap;
 
 // expand the description field
 $featuremap = chado_expand_var($featuremap, 'field', 'featuremap.description'); ?>
 
-<div class="tripal_featuremap-data-block-desc tripal-data-block-desc"></div> <?php 
+    <div class="tripal_featuremap-data-block-desc tripal-data-block-desc"></div> <?php
 
 // the $headers array is an array of fields to use as the colum headers. 
 // additional documentation can be found here 
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
 // This table for the analysis has a vertical header (down the first column)
 // so we do not provide headers here, but specify them in the $rows array below.
-$headers = array();
+$headers = [];
 
 // the $rows array contains an array of rows where each row is an array
 // of values for each column of the table in that row.  Additional documentation
 // can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-$rows = array();
+$rows = [];
 
 // Map Name row
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Map Name',
     'header' => TRUE,
     'width' => '20%',
-  ),
-  $featuremap->name
-);
+  ],
+  $featuremap->name,
+];
 // Map Units
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Map Units',
-    'header' => TRUE
-  ),
-  $featuremap->unittype_id->name
-);
+    'header' => TRUE,
+  ],
+  $featuremap->unittype_id->name,
+];
 // allow site admins to see the feature ID
 if (user_access('view ids')) {
   // Feature Map ID
-  $rows[] = array(
-    array(
+  $rows[] = [
+    [
       'data' => 'Feature Map ID',
       'header' => TRUE,
       'class' => 'tripal-site-admin-only-table-row',
-    ),
-    array(
+    ],
+    [
       'data' => $featuremap->featuremap_id,
       'class' => 'tripal-site-admin-only-table-row',
-    ),
-  );
+    ],
+  ];
 }
 
 // the $table array contains the headers and rows array as well as other
 // options for controlling the display of the table.  Additional
 // documentation can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-$table = array(
+$table = [
   'header' => $headers,
   'rows' => $rows,
-  'attributes' => array(
+  'attributes' => [
     'id' => 'tripal_featuremap-table-base',
-    'class' => 'tripal-data-table'
-  ),
+    'class' => 'tripal-data-table',
+  ],
   'sticky' => FALSE,
   'caption' => '',
-  'colgroups' => array(),
+  'colgroups' => [],
   'empty' => '',
-);
+];
 
 // once we have our table array structure defined, we call Drupal's theme_table()
 // function to generate the table.
 print theme_table($table);
 if (property_exists($featuremap, 'description')) { ?>
-  <div style="text-align: justify"><?php print $featuremap->description; ?></div> <?php  
+    <div style="text-align: justify"><?php print $featuremap->description; ?></div> <?php
 } 

+ 64 - 55
legacy/tripal_featuremap/theme/templates/tripal_featuremap_featurepos.tpl.php

@@ -1,6 +1,6 @@
 <?php
 $featuremap = $variables['node']->featuremap;
-$feature_positions = array();
+$feature_positions = [];
 
 // expand the featuremap object to include the records from the featurepos table
 // specify the number of features to show by default and the unique pager ID
@@ -8,26 +8,26 @@ $num_results_per_page = 25;
 $featurepos_pager_id = 0;
 
 // get the features aligned on this map
-$options = array(
+$options = [
   'return_array' => 1,
-  'order_by' => array('map_feature_id' => 'ASC'),
-  'pager' => array(
+  'order_by' => ['map_feature_id' => 'ASC'],
+  'pager' => [
     'limit' => $num_results_per_page,
-    'element' => $featurepos_pager_id
-  ),
-  'include_fk' => array(
-    'map_feature_id' => array(
+    'element' => $featurepos_pager_id,
+  ],
+  'include_fk' => [
+    'map_feature_id' => [
       'type_id' => 1,
       'organism_id' => 1,
-    ),
-    'feature_id' => array(
+    ],
+    'feature_id' => [
       'type_id' => 1,
-    ),
-    'featuremap_id' => array(
-       'unittype_id' => 1,
-    ),
-  ),
-);
+    ],
+    'featuremap_id' => [
+      'unittype_id' => 1,
+    ],
+  ],
+];
 
 $featuremap = chado_expand_var($featuremap, 'table', 'featurepos', $options);
 $feature_positions = $featuremap->featurepos;
@@ -37,45 +37,54 @@ $feature_positions = $featuremap->featurepos;
 $total_features = chado_pager_get_count($featurepos_pager_id);
 
 
-if(count($feature_positions) > 0){ ?>
-  <div class="tripal_featuremap-data-block-desc tripal-data-block-desc">This map contains <?php print number_format($total_features) ?> features:</div> <?php
+if (count($feature_positions) > 0) { ?>
+    <div class="tripal_featuremap-data-block-desc tripal-data-block-desc">This
+        map contains <?php print number_format($total_features) ?> features:
+    </div> <?php
 
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Landmark', 'Type', 'Organism', 'Feature Name', 'Type', 'Position');
+  $headers = [
+    'Landmark',
+    'Type',
+    'Organism',
+    'Feature Name',
+    'Type',
+    'Position',
+  ];
 
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
+  $rows = [];
 
-  foreach ($feature_positions as $position){
+  foreach ($feature_positions as $position) {
     $map_feature = $position->map_feature_id;
-    $feature     = $position->feature_id;
-    $organism    = $map_feature->organism_id;
+    $feature = $position->feature_id;
+    $organism = $map_feature->organism_id;
 
     // check if there are any values in the featureposprop table for the start and stop
     $mappos = $position->mappos;
-    $options = array(
+    $options = [
       'return_array' => 1,
-      'include_fk' => array(
+      'include_fk' => [
         'type_id' => 1,
-      ),
-    );
+      ],
+    ];
     $position = chado_expand_var($position, 'table', 'featureposprop', $options);
     $featureposprop = $position->featureposprop;
     $start = 0;
     $stop = 0;
     if (is_array($featureposprop)) {
       foreach ($featureposprop as $index => $property) {
-         if ($property->type_id->name == 'start') {
-           $start = $property->value;
-         }
-         if ($property->type_id->name == 'stop') {
-           $stop = $property->value;
-         }
+        if ($property->type_id->name == 'start') {
+          $start = $property->value;
+        }
+        if ($property->type_id->name == 'stop') {
+          $stop = $property->value;
+        }
       }
     }
     if ($start and $stop and $start != $stop) {
@@ -90,48 +99,48 @@ if(count($feature_positions) > 0){ ?>
 
     $mfname = $map_feature->name;
     if (property_exists($map_feature, 'nid')) {
-      $mfname =  l($mfname, 'node/' . $map_feature->nid, array('attributes' => array('target' => '_blank')));
+      $mfname = l($mfname, 'node/' . $map_feature->nid, ['attributes' => ['target' => '_blank']]);
     }
-    $orgname = $organism->genus ." " . $organism->species ." (" . $organism->common_name .")";
+    $orgname = $organism->genus . " " . $organism->species . " (" . $organism->common_name . ")";
     if (property_exists($organism, 'nid')) {
       $orgname = l(
-        "<i>" . $organism->genus . " " . $organism->species . "</i> (" . $organism->common_name .")",
-        "node/". $organism->nid,
-        array('html' => TRUE, 'attributes' => array('target' => '_blank'))
+        "<i>" . $organism->genus . " " . $organism->species . "</i> (" . $organism->common_name . ")",
+        "node/" . $organism->nid,
+        ['html' => TRUE, 'attributes' => ['target' => '_blank']]
       );
     }
-    $organism =  $organism->genus . ' ' . $organism->species;
+    $organism = $organism->genus . ' ' . $organism->species;
 
     $fname = $feature->name;
     if (property_exists($feature, 'nid')) {
-      $fname = l($fname, 'node/' . $feature->nid, array('attributes' => array('target' => '_blank')));
+      $fname = l($fname, 'node/' . $feature->nid, ['attributes' => ['target' => '_blank']]);
     }
 
-    $rows[] = array(
+    $rows[] = [
       $mfname,
       $map_feature->type_id->name,
       $orgname,
       $fname,
       $feature->type_id->name,
-      $mappos . ' ' . $position->featuremap_id->unittype_id->name
-    );
+      $mappos . ' ' . $position->featuremap_id->unittype_id->name,
+    ];
   }
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_featuremap-table-featurepos',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
+  ];
 
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
@@ -147,14 +156,14 @@ if(count($feature_positions) > 0){ ?>
   // Drupal won't reset the parameter if it already exists.
   $get = $_GET;
   unset($_GET['pane']);
-  $pager = array(
-    'tags' => array(),
+  $pager = [
+    'tags' => [],
     'element' => $featurepos_pager_id,
-    'parameters' => array(
-      'pane' => 'featurepos'
-    ),
+    'parameters' => [
+      'pane' => 'featurepos',
+    ],
     'quantity' => $num_results_per_page,
-  );
+  ];
   print theme_pager($pager);
   $_GET = $get;
 }

+ 46 - 25
legacy/tripal_featuremap/theme/templates/tripal_featuremap_help.tpl.php

@@ -1,36 +1,57 @@
 <h3>Module Description:</h3>
-<p>The Tripal Map module is an interface for the Chado Map module which groups features (sequences) into 
-   maps (typically genetic maps).
-   This module provides support for visualization of "map" pages, editing and updating.
+<p>The Tripal Map module is an interface for the Chado Map module which groups
+    features (sequences) into
+    maps (typically genetic maps).
+    This module provides support for visualization of "map" pages, editing and
+    updating.
 </p>
 
 <h3>Setup Instructions:</h3>
 <ol>
-   <li><p><b>Set Permissions</b>: By default only the site administrator account has access to create, edit, delete
-   or administer maps. Navigate to the <?php print l('permissions page', 'admin/user/permissions')?> and set the
-   permissions under the 'tripal_featuremap' section as appropriate for your site. For a simple setup, allow anonymous 
-   users access to view content and create a special role for creating, editing and other administrative tasks.</p></li>
- 
- <li><p><b>Create a Map</b>:  An map (called a feature map in Chado) can be <?php print l('created', 'node/add/chado-featuremap')?> 
- manually in the same way any other data type.  There is no loader for loading large files of map information including
- features that may be associated with these maps (e.g. genetic markers).  The Tripal bulk loader is the only way
- to load this type of data.</p></li>
- 
- <li><p><b>Sync any Existing Maps</b>: Before Maps can be viewed on the website, they must first be <?php print l('created manually', 'node/add/chado-featuremap')  ?> 
-          or if they already exist in the Chado database they must be synced. Near the top of the <?php print l('Map Configuration page', 'admin/tripal/tripal_featuremap/configuration') ?>
-          there is
-          a Sync Maps section which provides list of maps currently in chado which can be sync\'d.
-          Simply select the maps you would like to create Drupal/Tripal pages for and click Sync Maps. Once synced, 
-          pages will appear on the site for maps.</p></li>
- 
+    <li><p><b>Set Permissions</b>: By default only the site administrator
+            account has access to create, edit, delete
+            or administer maps. Navigate to
+            the <?php print l('permissions page', 'admin/user/permissions') ?>
+            and set the
+            permissions under the 'tripal_featuremap' section as appropriate for
+            your site. For a simple setup, allow anonymous
+            users access to view content and create a special role for creating,
+            editing and other administrative tasks.</p></li>
+
+    <li><p><b>Create a Map</b>: An map (called a feature map in Chado) can
+            be <?php print l('created', 'node/add/chado-featuremap') ?>
+            manually in the same way any other data type. There is no loader for
+            loading large files of map information including
+            features that may be associated with these maps (e.g. genetic
+            markers). The Tripal bulk loader is the only way
+            to load this type of data.</p></li>
+
+    <li><p><b>Sync any Existing Maps</b>: Before Maps can be viewed on the
+            website, they must first
+            be <?php print l('created manually', 'node/add/chado-featuremap') ?>
+            or if they already exist in the Chado database they must be synced.
+            Near the top of
+            the <?php print l('Map Configuration page', 'admin/tripal/tripal_featuremap/configuration') ?>
+            there is
+            a Sync Maps section which provides list of maps currently in chado
+            which can be sync\'d.
+            Simply select the maps you would like to create Drupal/Tripal pages
+            for and click Sync Maps. Once synced,
+            pages will appear on the site for maps.</p></li>
+
 </ol>
 
 
 <h3>Features of this Module:</h3>
 <ul>
-  <li><p><b>Edit or Delete Maps</b>: Maps can be manually edited or deleted by navigating to the map page and clicking the "Edit" button.</p></li>  
-    <li><p><b>Simple Search Tool</b>: A <?php print l('simple search tool','chado/featuremaps') ?> is provided for 
-    finding maps. This tool relies on Drupal Views.  <a href="http://drupal.org/project/views">Drupal Views</a>
-    which must be installed to see the search tool.  Look for it in the navigation menu under the item 
-    "Search Data". </p></li>
+    <li><p><b>Edit or Delete Maps</b>: Maps can be manually edited or deleted by
+            navigating to the map page and clicking the "Edit" button.</p></li>
+    <li><p><b>Simple Search Tool</b>:
+            A <?php print l('simple search tool', 'chado/featuremaps') ?> is
+            provided for
+            finding maps. This tool relies on Drupal Views. <a
+                    href="http://drupal.org/project/views">Drupal Views</a>
+            which must be installed to see the search tool. Look for it in the
+            navigation menu under the item
+            "Search Data". </p></li>
 </ul>

+ 15 - 15
legacy/tripal_featuremap/theme/templates/tripal_featuremap_properties.tpl.php

@@ -1,46 +1,46 @@
 <?php
 
 $featuremap = $variables['node']->featuremap;
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $featuremap = chado_expand_var($featuremap, 'table', 'featuremapprop', $options);
 $properties = $featuremap->featuremapprop;
 
-if(count($properties) > 0){
+if (count($properties) > 0) {
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Property Name', 'Value');
+  $headers = ['Property Name', 'Value'];
 
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
+  $rows = [];
 
-  foreach ($properties as $property){
-    $property = chado_expand_var($property,'field','featuremapprop.value');
-    $rows[] = array(
+  foreach ($properties as $property) {
+    $property = chado_expand_var($property, 'field', 'featuremapprop.value');
+    $rows[] = [
       ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-      urldecode($property->value)
-    );
+      urldecode($property->value),
+    ];
   }
 
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_featuremap-table-properties',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
+  ];
 
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.

+ 29 - 24
legacy/tripal_featuremap/theme/templates/tripal_featuremap_publication.tpl.php

@@ -2,24 +2,24 @@
 $featuremap = $variables['node']->featuremap;
 
 // expand featuremap to include pubs
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $featuremap = chado_expand_var($featuremap, 'table', 'featuremap_pub', $options);
 $featuremap_pubs = $featuremap->featuremap_pub;
 
 
 if (count($featuremap_pubs) > 0) { ?>
-  <div class="tripal_featuremap_pub-data-block-desc tripal-data-block-desc"></div> <?php
+    <div class="tripal_featuremap_pub-data-block-desc tripal-data-block-desc"></div> <?php
 
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Year', 'Publication');
+  $headers = ['Year', 'Publication'];
 
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
+  $rows = [];
 
   foreach ($featuremap_pubs as $featuremap_pub) {
     $pub = $featuremap_pub->pub_id;
@@ -27,13 +27,13 @@ if (count($featuremap_pubs) > 0) { ?>
     $citation = $pub->title;  // use the title as the default citation
 
     // get the citation for this pub if it exists
-    $values = array(
+    $values = [
       'pub_id' => $pub->pub_id,
-      'type_id' => array(
+      'type_id' => [
         'name' => 'Citation',
-      ),
-    );
-    $options = array('return_array' => 1);
+      ],
+    ];
+    $options = ['return_array' => 1];
     $citation_prop = chado_generate_var('pubprop', $values, $options);
     if (count($citation_prop) == 1) {
       $citation_prop = chado_expand_var($citation_prop, 'field', 'pubprop.value');
@@ -43,39 +43,44 @@ if (count($featuremap_pubs) > 0) { ?>
     // if the publication is synced then link to it
     if (property_exists($pub, 'nid')) {
       // replace the title with a link
-      $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
-      $patterns = array(
-        '/(\()/', '/(\))/',
-        '/(\])/', '/(\[)/',
-        '/(\{)/', '/(\})/',
-        '/(\+)/', '/(\.)/', '/(\?)/',
-      );
+      $link = l($pub->title, 'node/' . $pub->nid, ['attributes' => ['target' => '_blank']]);
+      $patterns = [
+        '/(\()/',
+        '/(\))/',
+        '/(\])/',
+        '/(\[)/',
+        '/(\{)/',
+        '/(\})/',
+        '/(\+)/',
+        '/(\.)/',
+        '/(\?)/',
+      ];
       $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
       $citation = preg_replace('/' . str_replace('/', ' ', $fixed_title) . '/', $link, $citation);
     }
 
-    $rows[] = array(
+    $rows[] = [
       $pub->pyear,
       $citation,
-    );
+    ];
   }
 
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_featuremap-table-publications',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
+  ];
 
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.

+ 35 - 33
legacy/tripal_featuremap/theme/templates/tripal_featuremap_references.tpl.php

@@ -1,67 +1,69 @@
 <?php
 $featuremap = $variables['node']->featuremap;
-$references = array();
+$references = [];
 
 // expand the featuremap object to include the records from the featuremap_dbxref table
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $featuremap = chado_expand_var($featuremap, 'table', 'featuremap_dbxref', $options);
 $featuremap_dbxrefs = $featuremap->featuremap_dbxref;
-if (count($featuremap_dbxrefs) > 0 ) {
-  foreach ($featuremap_dbxrefs as $featuremap_dbxref) {    
+if (count($featuremap_dbxrefs) > 0) {
+  foreach ($featuremap_dbxrefs as $featuremap_dbxref) {
     $references[] = $featuremap_dbxref->dbxref_id;
   }
 }
 
 
-if(count($references) > 0){ ?>
-  <div class="tripal_featuremap-data-block-desc tripal-data-block-desc">External references for this map</div><?php
-   
+if (count($references) > 0) { ?>
+    <div class="tripal_featuremap-data-block-desc tripal-data-block-desc">
+        External references for this map
+    </div><?php
+
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Database', 'Accession');
-  
+  $headers = ['Database', 'Accession'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
+  $rows = [];
+
+  foreach ($references as $dbxref) {
+    $dbname = $dbxref->db_id->name;
+    if ($dbxref->db_id->url) {
+      $dbname = l($dbname, $dbxref->db_id->url, ['attributes' => ['target' => '_blank']]);
+    }
 
-  foreach ($references as $dbxref){
-    $dbname = $dbxref->db_id->name; 
-    if ($dbxref->db_id->url) { 
-      $dbname = l($dbname, $dbxref->db_id->url, array('attributes' => array('target' => '_blank')));
-    } 
-    
-    $accession = $dbxref->accession; 
-    if ($dbxref->db_id->urlprefix) { 
-      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
-    } 
-    $rows[] = array(
+    $accession = $dbxref->accession;
+    if ($dbxref->db_id->urlprefix) {
+      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, ['attributes' => ['target' => '_blank']]);
+    }
+    $rows[] = [
       $dbname,
-      $accession
-    );
-  } 
-  
+      $accession,
+    ];
+  }
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_featuremap-table-references',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table);  
+  print theme_table($table);
 }
 

+ 11 - 11
legacy/tripal_featuremap/theme/templates/tripal_featuremap_teaser.tpl.php

@@ -1,16 +1,16 @@
 <?php
 $node = $variables['node'];
 $featuremap = $variables['node']->featuremap;
-$featuremap = chado_expand_var($featuremap,'field','featuremap.description'); ?>
+$featuremap = chado_expand_var($featuremap, 'field', 'featuremap.description'); ?>
 
-<div class="tripal_featuremap-teaser tripal-teaser"> 
-  <div class="tripal-featuremap-teaser-title tripal-teaser-title"><?php 
-    print l($node->title, "node/$node->nid", array('html' => TRUE));?>
-  </div>
-  <div class="tripal-featuremap-teaser-text tripal-teaser-text"><?php 
-    print substr($featuremap->description, 0, 650);
-    if (strlen($featuremap->description) > 650) {
-      print "... " . l("[more]", "node/$node->nid");
-    } ?>
-  </div>
+<div class="tripal_featuremap-teaser tripal-teaser">
+    <div class="tripal-featuremap-teaser-title tripal-teaser-title"><?php
+      print l($node->title, "node/$node->nid", ['html' => TRUE]); ?>
+    </div>
+    <div class="tripal-featuremap-teaser-text tripal-teaser-text"><?php
+      print substr($featuremap->description, 0, 650);
+      if (strlen($featuremap->description) > 650) {
+        print "... " . l("[more]", "node/$node->nid");
+      } ?>
+    </div>
 </div>

+ 47 - 47
legacy/tripal_featuremap/tripal_featuremap.views_default.inc

@@ -10,7 +10,7 @@
  * @ingroup tripal_legacy_featuremap
  */
 function tripal_featuremap_views_default_views() {
-  $views = array();
+  $views = [];
 
   // User View ("Search Biological Content")
   // Remember, if you change the name/path of this view,
@@ -46,12 +46,12 @@ function tripal_featuremap_defaultvalue_user_featuremaps() {
 
   // Change the path
   $view->display['page_1']->display_options['path'] = 'chado/featuremap';
-  $view->display['page_1']->display_options['menu'] = array(
+  $view->display['page_1']->display_options['menu'] = [
     'type' => 'normal',
     'title' => 'Maps',
     'description' => 'A map of features from the chado database (e.g. genetic map)',
-    'weight' => '-10'
-  );
+    'weight' => '-10',
+  ];
   unset($view->display['page_1']->display_options['tab_options']);
 
   // Change the permission
@@ -106,52 +106,52 @@ function tripal_featuremap_defaultview_admin_featuremaps() {
   $handler->display->display_options['pager']['options']['quantity'] = '9';
   $handler->display->display_options['style_plugin'] = 'table';
   $handler->display->display_options['style_options']['grouping'] = '';
-  $handler->display->display_options['style_options']['columns'] = array(
-  'name' => 'name',
-  'description' => 'description',
-  'name_1' => 'name_1',
-  'nid' => 'nid',
-  );
+  $handler->display->display_options['style_options']['columns'] = [
+    'name' => 'name',
+    'description' => 'description',
+    'name_1' => 'name_1',
+    'nid' => 'nid',
+  ];
   $handler->display->display_options['style_options']['default'] = '-1';
-  $handler->display->display_options['style_options']['info'] = array(
-  'name' => array(
-    'sortable' => 1,
-    'separator' => '',
-  ),
-  'description' => array(
-    'sortable' => 1,
-    'separator' => '',
-  ),
-  'name_1' => array(
-    'sortable' => 1,
-    'separator' => '',
-  ),
-  'nid' => array(
-    'separator' => '',
-  ),
-  );
+  $handler->display->display_options['style_options']['info'] = [
+    'name' => [
+      'sortable' => 1,
+      'separator' => '',
+    ],
+    'description' => [
+      'sortable' => 1,
+      'separator' => '',
+    ],
+    'name_1' => [
+      'sortable' => 1,
+      'separator' => '',
+    ],
+    'nid' => [
+      'separator' => '',
+    ],
+  ];
   /* Header: Global: Action Links */
   $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
   $handler->display->display_options['header']['action_links_area']['table'] = 'views';
   $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
   $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
   $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
-  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
-  'label-1' => 'Add Map',
-  'path-1' => 'node/add/tripal-featuremap',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
-  'label-2' => '',
-  'path-2' => '',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
-  'label-3' => '',
-  'path-3' => '',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
-  'label-4' => '',
-  'path-4' => '',
-  );
+  $handler->display->display_options['header']['action_links_area']['link-1'] = [
+    'label-1' => 'Add Map',
+    'path-1' => 'node/add/tripal-featuremap',
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-2'] = [
+    'label-2' => '',
+    'path-2' => '',
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-3'] = [
+    'label-3' => '',
+    'path-3' => '',
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-4'] = [
+    'label-4' => '',
+    'path-4' => '',
+  ];
   /* No results behavior: Global: Text area */
   $handler->display->display_options['empty']['text']['id'] = 'area';
   $handler->display->display_options['empty']['text']['table'] = 'views';
@@ -229,11 +229,11 @@ function tripal_featuremap_defaultview_admin_featuremaps() {
   $handler->display->display_options['filters']['name_1']['expose']['label'] = 'Name Contains';
   $handler->display->display_options['filters']['name_1']['expose']['operator'] = 'name_1_op';
   $handler->display->display_options['filters']['name_1']['expose']['identifier'] = 'name_1';
-  $handler->display->display_options['filters']['name_1']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['name_1']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
   /* Filter criterion: Chado Featuremap: Description */
   $handler->display->display_options['filters']['description']['id'] = 'description';
   $handler->display->display_options['filters']['description']['table'] = 'featuremap';
@@ -245,11 +245,11 @@ function tripal_featuremap_defaultview_admin_featuremaps() {
   $handler->display->display_options['filters']['description']['expose']['label'] = 'Description Contains';
   $handler->display->display_options['filters']['description']['expose']['operator'] = 'description_op';
   $handler->display->display_options['filters']['description']['expose']['identifier'] = 'description';
-  $handler->display->display_options['filters']['description']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['description']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
 
   /* Display: Page */
   $handler = $view->new_display('page', 'Page', 'page_1');

+ 3 - 3
legacy/tripal_genetic/includes/tripal_genetic.admin.inc

@@ -13,7 +13,7 @@ function tripal_genetic_admin_genetics_listing() {
   $output = '';
 
   // set the breadcrumb
-  $breadcrumb = array();
+  $breadcrumb = [];
   $breadcrumb[] = l('Home', '<front>');
   $breadcrumb[] = l('Administration', 'admin');
   $breadcrumb[] = l('Tripal', 'admin/tripal');
@@ -22,7 +22,7 @@ function tripal_genetic_admin_genetics_listing() {
   drupal_set_breadcrumb($breadcrumb);
 
   // Add the view
-  $view = views_embed_view('tripal_genetic_admin_genetics','default');
+  $view = views_embed_view('tripal_genetic_admin_genetics', 'default');
   if (isset($view)) {
     $output .= $view;
   }
@@ -32,7 +32,7 @@ function tripal_genetic_admin_genetics_listing() {
       . 'administrative interface are disabled. <strong>Click each of the following links to '
       . 'enable the pertinent views</strong>:</p>';
     $output .= '<ul>';
-      $output .= '<li>'.l('Genetic Admin', 'admin/tripal/legacy/tripal_genetic/views/genetics/enable').'</li>';
+    $output .= '<li>' . l('Genetic Admin', 'admin/tripal/legacy/tripal_genetic/views/genetics/enable') . '</li>';
     $output .= '</ul>';
   }
 

+ 43 - 41
legacy/tripal_genetic/theme/templates/tripal_feature_genotypes.tpl.php

@@ -29,13 +29,13 @@ $num_results_per_page = 25;
 $feature_pager_id = 15;
 
 // get the genotypes from the feature_genotype table
-$options = array(
+$options = [
   'return_array' => 1,
-  'pager' => array(
+  'pager' => [
     'limit' => $num_results_per_page,
-    'element' => $feature_pager_id
-  ),
-);
+    'element' => $feature_pager_id,
+  ],
+];
 $feature = chado_expand_var($feature, 'table', 'feature_genotype', $options);
 $feature_genotypes = $feature->feature_genotype->feature_id;
 
@@ -43,26 +43,28 @@ $feature_genotypes = $feature->feature_genotype->feature_id;
 $total_records = chado_pager_get_count($feature_pager_id);
 
 // now iterate through the feature genotypes and print a paged table.
-if (count($feature_genotypes) > 0) {?>
-  <div class="tripal_feature-data-block-desc tripal-data-block-desc">This following <?php print number_format($total_records) ?> genotype(s) have been recorded for this feature.</div><?php
+if (count($feature_genotypes) > 0) { ?>
+    <div class="tripal_feature-data-block-desc tripal-data-block-desc">This
+    following <?php print number_format($total_records) ?> genotype(s) have been
+    recorded for this feature.</div><?php
 
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Name', 'Type', 'Genotype', 'Details', 'Germplasm');
+  $headers = ['Name', 'Type', 'Genotype', 'Details', 'Germplasm'];
 
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
+  $rows = [];
 
-  foreach($feature_genotypes as $feature_genotype) {
+  foreach ($feature_genotypes as $feature_genotype) {
     $genotype = $feature_genotype->genotype_id;
 
     // show the uniquename for the genotype unless a name exists
     $name = $genotype->uniquename;
-    if ($genotype->name){
+    if ($genotype->name) {
       $name = $genotype->name;
     }
 
@@ -73,68 +75,68 @@ if (count($feature_genotypes) > 0) {?>
     }
 
     // get the genotype properties
-    $options = array('return_array' => 1);
+    $options = ['return_array' => 1];
     $genotype = chado_expand_var($genotype, 'table', 'genotypeprop', $options);
     $properties = $genotype->genotypeprop;
     $details = '';
-    if(count($properties) > 0) {
-      foreach ($properties as $property){
-        $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
+    if (count($properties) > 0) {
+      foreach ($properties as $property) {
+        $details .= ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
       }
       $details = substr($details, 0, -4); // remove trailing <br>
     }
 
     // add in stocks associated with this genotype if any
-    $options = array(
+    $options = [
       'return_array' => 1,
-      'inlude_fk' => array(
-        'stock_id' => array(
-          'type_id' => 1
-        )
-      ),
-    );
+      'inlude_fk' => [
+        'stock_id' => [
+          'type_id' => 1,
+        ],
+      ],
+    ];
     $genotype = chado_expand_var($genotype, 'table', 'stock_genotype', $options);
     $stock_genotypes = $genotype->stock_genotype;
 
     // build the list of germplasm.
     $stock_names = '';
-    if(count($stock_genotypes) > 0) {
-      foreach ($stock_genotypes as $stock_genotype){
+    if (count($stock_genotypes) > 0) {
+      foreach ($stock_genotypes as $stock_genotype) {
         $stock = $stock_genotype->stock_id;
         $stock_name = $stock->name . ' (' . $stock->uniquename . ')';
-        if(property_exists($stock, 'nid')) {
-          $stock_name = l($stock_name, 'node/' . $stock->nid, array('attributes' => array('target' => '_blank')));
+        if (property_exists($stock, 'nid')) {
+          $stock_name = l($stock_name, 'node/' . $stock->nid, ['attributes' => ['target' => '_blank']]);
         }
         $stock_names .= $stock_name . '<br>';
       }
       $stock_names = substr($stock_names, 0, -4); // remove trailing <br>
     }
     // add the fields to the table row
-    $rows[] = array(
+    $rows[] = [
       $name,
       $type,
       $genotype->description,
       $details,
-      $stock_names
-    );
+      $stock_names,
+    ];
   }
 
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_genetic-table-genotypes',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
+  ];
 
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
@@ -150,14 +152,14 @@ if (count($feature_genotypes) > 0) {?>
   // Drupal won't reset the parameter if it already exists.
   $get = $_GET;
   unset($_GET['pane']);
-  $pager = array(
-    'tags' => array(),
+  $pager = [
+    'tags' => [],
     'element' => $feature_pager_id,
-    'parameters' => array(
-      'pane' => 'genotypes'
-    ),
+    'parameters' => [
+      'pane' => 'genotypes',
+    ],
     'quantity' => $num_results_per_page,
-  );
+  ];
   print theme_pager($pager);
   $_GET = $get;
 }

+ 47 - 44
legacy/tripal_genetic/theme/templates/tripal_stock_genotypes.tpl.php

@@ -19,16 +19,16 @@ $num_results_per_page = 25;
 $stock_pager_id = 15;
 
 // get the genotypes from the stock_genotype table
-$options = array(
+$options = [
   'return_array' => 1,
-  'pager' => array(
+  'pager' => [
     'limit' => $num_results_per_page,
-    'element' => $stock_pager_id
-  ),
-  'fk_include' => array(
-    'genotype_id' => 1
-  ),
-);
+    'element' => $stock_pager_id,
+  ],
+  'fk_include' => [
+    'genotype_id' => 1,
+  ],
+];
 $stock = chado_expand_var($stock, 'table', 'stock_genotype', $options);
 $stock_genotypes = $stock->stock_genotype;
 
@@ -36,43 +36,46 @@ $stock_genotypes = $stock->stock_genotype;
 $total_records = chado_pager_get_count($stock_pager_id);
 
 // now iterate through the stock genotypes and print a paged table.
-if (count($stock_genotypes) > 0) {?>
-  <div class="tripal_stock-data-block-desc tripal-data-block-desc">The following <?php print number_format($total_records) ?> genotype(s) have been recorded for this stock.</div> <?php
+if (count($stock_genotypes) > 0) { ?>
+    <div class="tripal_stock-data-block-desc tripal-data-block-desc">The
+        following <?php print number_format($total_records) ?> genotype(s) have
+        been recorded for this stock.
+    </div> <?php
 
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Name', 'Type', 'Genotype', 'Details', 'Markers');
+  $headers = ['Name', 'Type', 'Genotype', 'Details', 'Markers'];
 
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
+  $rows = [];
 
-  foreach($stock_genotypes as $stock_genotype) {
+  foreach ($stock_genotypes as $stock_genotype) {
     $genotype = $stock_genotype->genotype_id;
 
     // get the genotype properties
-    $options = array('return_array' => 1);
+    $options = ['return_array' => 1];
     $genotype = chado_expand_var($genotype, 'table', 'genotypeprop', $options);
     $properties = $genotype->genotypeprop;
 
     // add in markers associated with this genotype if any
-    $options = array(
+    $options = [
       'return_array' => 1,
-      'inlude_fk' => array(
-        'feature_id' => array(
-          'type_id' => 1
-        )
-      ),
-    );
+      'inlude_fk' => [
+        'feature_id' => [
+          'type_id' => 1,
+        ],
+      ],
+    ];
     $genotype = chado_expand_var($genotype, 'table', 'feature_genotype', $options);
     $feature_genotypes = $genotype->feature_genotype;
 
     // show the uniquename for the genotype unless a name exists
     $name = $genotype->uniquename;
-    if ($genotype->name){
+    if ($genotype->name) {
       $name = $genotype->name;
     }
     // get the genotype type
@@ -83,22 +86,22 @@ if (count($stock_genotypes) > 0) {?>
 
     // get the genotype properties
     $details = '';
-    if(count($properties) > 0) {
-      foreach ($properties as $property){
-        $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
+    if (count($properties) > 0) {
+      foreach ($properties as $property) {
+        $details .= ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
       }
       $details = substr($details, 0, -4); // remove trailing <br>
     }
 
     // build the list of marker features.
     $feature_names = 'N/A';
-    if(count($feature_genotypes) > 0) {
+    if (count($feature_genotypes) > 0) {
       $feature_names = '';
-      foreach ($feature_genotypes as $feature_genotype){
+      foreach ($feature_genotypes as $feature_genotype) {
         $feature = $feature_genotype->feature_id;
         $feature_name = $feature->name . ' (' . $feature->uniquename . ')';
-        if(property_exists($feature, 'nid')) {
-          $feature_name = l($feature_name, 'node/' . $feature->nid, array('attributes' => array('target' => '_blank')));
+        if (property_exists($feature, 'nid')) {
+          $feature_name = l($feature_name, 'node/' . $feature->nid, ['attributes' => ['target' => '_blank']]);
         }
         $feature_names .= $feature_name . '<br>';
       }
@@ -106,31 +109,31 @@ if (count($stock_genotypes) > 0) {?>
     }
 
     // add the fields to the table row
-    $rows[] = array(
+    $rows[] = [
       $name,
       $type,
       $genotype->description,
       $details,
-      $feature_names
-    );
+      $feature_names,
+    ];
   }
 
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_genetic-table-genotypes',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
+  ];
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
   print theme_table($table);
@@ -145,14 +148,14 @@ if (count($stock_genotypes) > 0) {?>
   // Drupal won't reset the parameter if it already exists.
   $get = $_GET;
   unset($_GET['pane']);
-  $pager = array(
-    'tags' => array(),
+  $pager = [
+    'tags' => [],
     'element' => $stock_pager_id,
-    'parameters' => array(
-      'pane' => 'genotypes'
-    ),
+    'parameters' => [
+      'pane' => 'genotypes',
+    ],
     'quantity' => $num_results_per_page,
-  );
+  ];
   print theme_pager($pager);
   $_GET = $get;
 }

+ 18 - 18
legacy/tripal_genetic/tripal_genetic.views_default.inc

@@ -10,7 +10,7 @@
  * @ingroup tripal_genetic
  */
 function tripal_genetic_views_default_views() {
-  $views = array();
+  $views = [];
 
   // User View ("Search Biological Content")
   // Remember, if you change the name/path of this view,
@@ -46,12 +46,12 @@ function tripal_genetic_defaultvalue_user_genotypes() {
 
   // Change the path
   $view->display['page_1']->display_options['path'] = 'chado/genotype';
-  $view->display['page_1']->display_options['menu'] = array(
+  $view->display['page_1']->display_options['menu'] = [
     'type' => 'normal',
     'title' => 'Genotypes',
     'description' => 'Genetic variations such as SNPs, MNPs and indels.',
-    'weight' => '-10'
-  );
+    'weight' => '-10',
+  ];
   unset($view->display['page_1']->display_options['tab_options']);
 
   // Remove edit/delete node
@@ -102,26 +102,26 @@ function tripal_genetic_defaultviews_admin_genotypes() {
   $handler->display->display_options['pager']['options']['quantity'] = '9';
   $handler->display->display_options['style_plugin'] = 'table';
   $handler->display->display_options['style_options']['grouping'] = '';
-  $handler->display->display_options['style_options']['columns'] = array(
+  $handler->display->display_options['style_options']['columns'] = [
     'uniquename' => 'uniquename',
     'name' => 'name',
     'description' => 'description',
-  );
+  ];
   $handler->display->display_options['style_options']['default'] = 'uniquename';
-  $handler->display->display_options['style_options']['info'] = array(
-    'uniquename' => array(
+  $handler->display->display_options['style_options']['info'] = [
+    'uniquename' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'name' => array(
+    ],
+    'name' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'description' => array(
+    ],
+    'description' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-  );
+    ],
+  ];
   /* No results behavior: Global: Text area */
   $handler->display->display_options['empty']['text']['id'] = 'area';
   $handler->display->display_options['empty']['text']['table'] = 'views';
@@ -156,11 +156,11 @@ function tripal_genetic_defaultviews_admin_genotypes() {
   $handler->display->display_options['filters']['uniquename']['expose']['label'] = 'Unique Name Contains';
   $handler->display->display_options['filters']['uniquename']['expose']['operator'] = 'uniquename_op';
   $handler->display->display_options['filters']['uniquename']['expose']['identifier'] = 'uniquename';
-  $handler->display->display_options['filters']['uniquename']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['uniquename']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
   /* Filter criterion: Chado Genotype: Description */
   $handler->display->display_options['filters']['description']['id'] = 'description';
   $handler->display->display_options['filters']['description']['table'] = 'genotype';
@@ -172,11 +172,11 @@ function tripal_genetic_defaultviews_admin_genotypes() {
   $handler->display->display_options['filters']['description']['expose']['label'] = 'Description Contains';
   $handler->display->display_options['filters']['description']['expose']['operator'] = 'description_op';
   $handler->display->display_options['filters']['description']['expose']['identifier'] = 'description';
-  $handler->display->display_options['filters']['description']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['description']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
 
   /* Display: Page */
   $handler = $view->new_display('page', 'Page', 'page_1');

+ 47 - 46
legacy/tripal_library/api/tripal_library.DEPRECATED.inc

@@ -1,13 +1,14 @@
 <?php
 /**
  * @file
- * Wrapper functions to provide backwards compatibility for the tripal library api
+ * Wrapper functions to provide backwards compatibility for the tripal library
+ *   api
  */
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_get_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_get_property().
  *
  * @see chado_get_property().
  */
@@ -17,27 +18,27 @@ function tripal_library_get_property($library_id, $property) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_library_get_property',
-      '%new_function' => 'chado_get_property'
-    )
+    [
+      '%old_function' => 'tripal_library_get_property',
+      '%new_function' => 'chado_get_property',
+    ]
   );
 
-  $record = array(
+  $record = [
     'table' => 'library',
     'id' => $library_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
-    'cv_name' => 'library_property'
-  );
+    'cv_name' => 'library_property',
+  ];
   return chado_get_property($record, $property);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_insert_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_insert_property().
  *
  * @see chado_insert_property().
  */
@@ -47,31 +48,31 @@ function tripal_library_insert_property($library_id, $property, $value, $update_
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_library_insert_property',
-      '%new_function' => 'chado_insert_property'
-    )
+    [
+      '%old_function' => 'tripal_library_insert_property',
+      '%new_function' => 'chado_insert_property',
+    ]
   );
 
-  $record = array(
+  $record = [
     'table' => 'library',
     'id' => $library_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => 'library_property',
     'value' => $value,
-  );
-  $options = array(
+  ];
+  $options = [
     'update_if_present' => $update_if_present,
-  );
+  ];
   return chado_insert_property($record, $property, $options);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_update_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_update_property().
  *
  * @see chado_update_property().
  */
@@ -81,30 +82,30 @@ function tripal_library_update_property($library_id, $property, $value, $insert_
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_library_update_property',
-      '%new_function' => 'chado_update_property'
-    )
+    [
+      '%old_function' => 'tripal_library_update_property',
+      '%new_function' => 'chado_update_property',
+    ]
   );
-  $record = array(
+  $record = [
     'table' => 'library',
     'id' => $library_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => 'library_property',
     'value' => $value,
-  );
-  $options = array(
+  ];
+  $options = [
     'insert_if_missing' => $insert_if_missing,
-  );
+  ];
   return chado_update_property($record, $property, $options);
 }
 
 /**
  * @deprecated Restructured API to make naming more readable and consistent.
- * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
- * This function has been replaced by chado_delete_property().
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
+ *   now. This function has been replaced by chado_delete_property().
  *
  * @see chado_delete_property().
  */
@@ -114,18 +115,18 @@ function tripal_library_delete_property($library_id, $property) {
     'tripal_deprecated',
     TRIPAL_NOTICE,
     "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
-    array(
-      '%old_function'=>'tripal_library_delete_property',
-      '%new_function' => 'chado_delete_property'
-    )
+    [
+      '%old_function' => 'tripal_library_delete_property',
+      '%new_function' => 'chado_delete_property',
+    ]
   );
-  $record = array(
+  $record = [
     'table' => 'library',
     'id' => $library_id,
-  );
-  $property = array(
+  ];
+  $property = [
     'type_name' => $property,
     'cv_name' => 'library_property',
-  );
+  ];
   return chado_delete_property($record, $property);
 }

+ 22 - 20
legacy/tripal_library/includes/tripal_library.admin.inc

@@ -13,7 +13,7 @@ function tripal_library_admin_libraries_listing() {
   $output = '';
 
   // set the breadcrumb
-  $breadcrumb = array();
+  $breadcrumb = [];
   $breadcrumb[] = l('Home', '<front>');
   $breadcrumb[] = l('Administration', 'admin');
   $breadcrumb[] = l('Tripal', 'admin/tripal');
@@ -22,7 +22,7 @@ function tripal_library_admin_libraries_listing() {
   drupal_set_breadcrumb($breadcrumb);
 
   // Add the view
-  $view = views_embed_view('tripal_library_admin_libraries','default');
+  $view = views_embed_view('tripal_library_admin_libraries', 'default');
   if (isset($view)) {
     $output .= $view;
   }
@@ -32,7 +32,7 @@ function tripal_library_admin_libraries_listing() {
       . 'administrative interface are disabled. <strong>Click each of the following links to '
       . 'enable the pertinent views</strong>:</p>';
     $output .= '<ul>';
-      $output .= '<li>'.l('Library Admin', 'admin/tripal/legacy/tripal_library/views/libraries/enable').'</li>';
+    $output .= '<li>' . l('Library Admin', 'admin/tripal/legacy/tripal_library/views/libraries/enable') . '</li>';
     $output .= '</ul>';
   }
 
@@ -45,36 +45,38 @@ function tripal_library_admin_libraries_listing() {
  * @ingroup tripal_legacy_library
  */
 function tripal_library_admin() {
-  $form = array();
+  $form = [];
 
   // If your module is using the Chado Node: Title & Path API to allow custom titles
   // for your node type then you need to add the configuration form for this functionality.
-  $details = array(
-    'module' => 'tripal_library',       // the name of the MODULE implementing the content type
-    'content_type' => 'chado_library',   // the name of the content type
-      // An array of options to use under "Page Titles"
-      // the key should be the token and the value should be the human-readable option
-    'options' => array(
+  $details = [
+    'module' => 'tripal_library',
+    // the name of the MODULE implementing the content type
+    'content_type' => 'chado_library',
+    // the name of the content type
+    // An array of options to use under "Page Titles"
+    // the key should be the token and the value should be the human-readable option
+    'options' => [
       '[library.name]' => 'Library Name Only',
-        // there should always be one options matching the unique constraint.
-      '[library.name], [library.uniquename] ([library.type_id>cvterm.name]) [library.organism_id>organism.genus] [library.organism_id>organism.species]' => 'Unique Contraint: Includes the name, type and organism scientific name'
-    ),
+      // there should always be one options matching the unique constraint.
+      '[library.name], [library.uniquename] ([library.type_id>cvterm.name]) [library.organism_id>organism.genus] [library.organism_id>organism.species]' => 'Unique Contraint: Includes the name, type and organism scientific name',
+    ],
     // the token indicating the unique constraint in the options array
-    'unique_option' => '[library.name], [library.uniquename] ([library.type_id>cvterm.name]) [library.organism_id>organism.genus] [library.organism_id>organism.species]'
-  );
+    'unique_option' => '[library.name], [library.uniquename] ([library.type_id>cvterm.name]) [library.organism_id>organism.genus] [library.organism_id>organism.species]',
+  ];
   // This call adds the configuration form to your current form
   // This sub-form handles it's own validation & submit
   chado_add_admin_form_set_title($form, $form_state, $details);
 
   // URL ALIAS
-  $details = array(
+  $details = [
     'module' => 'tripal_library',
     'content_type' => 'chado_library',
-    'options' => array(
+    'options' => [
       '/library/[library.library_id]' => 'Library ID',
-      '/library/[library.organism_id>organism.genus]/[library.organism_id>organism.species]/[library.type_id>cvterm.name]/[library.uniquename]' => 'Unique Contraint: Includes the name, uniquename, type and scientific name'
-    ),
-  );
+      '/library/[library.organism_id>organism.genus]/[library.organism_id>organism.species]/[library.type_id>cvterm.name]/[library.uniquename]' => 'Unique Contraint: Includes the name, uniquename, type and scientific name',
+    ],
+  ];
 
   // This call adds the configuration form to your current form
   // This sub-form handles it's own validation & submit

+ 195 - 175
legacy/tripal_library/includes/tripal_library.chado_node.inc

@@ -13,26 +13,26 @@
  * @ingroup tripal_legacy_library
  */
 function tripal_library_node_info() {
-  $nodes = array();
-  $nodes['chado_library'] = array(
-    'name'        => t('Library (Tripal v2 legacy)'),
-    'base'        => 'chado_library',
+  $nodes = [];
+  $nodes['chado_library'] = [
+    'name' => t('Library (Tripal v2 legacy)'),
+    'base' => 'chado_library',
     'description' => t('A library from the chado database'),
-    'has_title'   => TRUE,
-    'locked'      => TRUE,
-    'chado_node_api' => array(
+    'has_title' => TRUE,
+    'locked' => TRUE,
+    'chado_node_api' => [
       'base_table' => 'library',
       'hook_prefix' => 'chado_library',
-      'record_type_title' => array(
+      'record_type_title' => [
         'singular' => t('Library'),
-        'plural' => t('Libraries')
-      ),
-      'sync_filters' => array(
+        'plural' => t('Libraries'),
+      ],
+      'sync_filters' => [
         'type_id' => TRUE,
-        'organism_id' => TRUE
-      ),
-    )
-  );
+        'organism_id' => TRUE,
+      ],
+    ],
+  ];
   return $nodes;
 }
 
@@ -45,7 +45,7 @@ function tripal_library_node_info() {
  * @ingroup tripal_legacy_library
  */
 function chado_library_form($node, &$form_state) {
-  $form = array();
+  $form = [];
 
   // Default values can come in the following ways:
   //
@@ -68,58 +68,58 @@ function chado_library_form($node, &$form_state) {
     $library = $node->library;
     $library_id = $library->library_id;
 
-    $libraryname  = $library->name;
-    $uniquename   = $library->uniquename;
+    $libraryname = $library->name;
+    $uniquename = $library->uniquename;
     $library_type = $library->type_id->cvterm_id;
-    $organism_id  = $library->organism_id->organism_id;
+    $organism_id = $library->organism_id->organism_id;
 
     $libprop = chado_get_property(
-      array('table' => 'library', 'id' => $library->library_id),
-      array('type_name' => 'Library Description', 'cv_name' => 'library_property')
+      ['table' => 'library', 'id' => $library->library_id],
+      ['type_name' => 'Library Description', 'cv_name' => 'library_property']
     );
     $description = $libprop->value;
 
     // keep track of the library id if we have.  If we do have one then
     // this is an update as opposed to an insert.
-    $form['library_id'] = array(
+    $form['library_id'] = [
       '#type' => 'value',
       '#value' => $library_id,
-    );
+    ];
   }
   // if we are re constructing the form from a failed validation or ajax callback
   // then use the $form_state['values'] values
   if (array_key_exists('values', $form_state)) {
-    $libraryname  = $form_state['values']['libraryname'];
-    $uniquename   = $form_state['values']['uniquename'];
+    $libraryname = $form_state['values']['libraryname'];
+    $uniquename = $form_state['values']['uniquename'];
     $library_type = $form_state['values']['library_type'];
-    $organism_id  = $form_state['values']['organism_id'];
-    $description  = $form_state['values']['description'];
+    $organism_id = $form_state['values']['organism_id'];
+    $description = $form_state['values']['description'];
   }
   // if we are re building the form from after submission (from ajax call) then
   // the values are in the $form_state['input'] array
   if (array_key_exists('input', $form_state) and !empty($form_state['input'])) {
-    $libraryname  = $form_state['input']['libraryname'];
-    $uniquename   = $form_state['input']['uniquename'];
+    $libraryname = $form_state['input']['libraryname'];
+    $uniquename = $form_state['input']['uniquename'];
     $library_type = $form_state['input']['library_type'];
-    $organism_id  = $form_state['input']['organism_id'];
-    $description  = $form_state['input']['description'];
+    $organism_id = $form_state['input']['organism_id'];
+    $description = $form_state['input']['description'];
   }
 
-  $form['libraryname']= array(
-    '#type'          => 'textfield',
-    '#title'         => t('Library Name'),
-    '#description'   => t('Please enter the name for this library. Library names should be recognizable but do not need to be unique.'),
-    '#required'      => TRUE,
+  $form['libraryname'] = [
+    '#type' => 'textfield',
+    '#title' => t('Library Name'),
+    '#description' => t('Please enter the name for this library. Library names should be recognizable but do not need to be unique.'),
+    '#required' => TRUE,
     '#default_value' => $libraryname,
-  );
+  ];
 
-  $form['uniquename']= array(
-    '#type'          => 'textfield',
-    '#title'         => t('Unique Name'),
-    '#description'   => t('Please enter a unique name for this library. This can be any value used to uniquely identify a library.'),
-    '#required'      => TRUE,
+  $form['uniquename'] = [
+    '#type' => 'textfield',
+    '#title' => t('Unique Name'),
+    '#description' => t('Please enter a unique name for this library. This can be any value used to uniquely identify a library.'),
+    '#required' => TRUE,
     '#default_value' => $uniquename,
-  );
+  ];
 
   // get the list of library types
   $lt_cv = tripal_get_default_cv("library", "type_id");
@@ -127,72 +127,72 @@ function chado_library_form($node, &$form_state) {
   $types[0] = 'Select a Type';
   $lt_message = tripal_set_message("To add additional items to the library type drop down list,
      add a term to the " .
-     l($lt_cv->name . " controlled vocabulary",
-       "admin/tripal/loaders/chado_vocabs/chado_cv/" . $lt_cv->cv_id . "/cvterm/add",
-       array('attributes' => array('target' => '_blank'))
-      ),
-     TRIPAL_INFO, array('return_html' => TRUE)
+    l($lt_cv->name . " controlled vocabulary",
+      "admin/tripal/loaders/chado_vocabs/chado_cv/" . $lt_cv->cv_id . "/cvterm/add",
+      ['attributes' => ['target' => '_blank']]
+    ),
+    TRIPAL_INFO, ['return_html' => TRUE]
   );
 
-  $form['library_type'] = array(
-    '#title'         => t('Library Type'),
-    '#type'          => t('select'),
-    '#description'   => t("Choose the library type."),
-    '#required'      => TRUE,
+  $form['library_type'] = [
+    '#title' => t('Library Type'),
+    '#type' => t('select'),
+    '#description' => t("Choose the library type."),
+    '#required' => TRUE,
     '#default_value' => $library_type,
-    '#options'       => $types,
-    '#suffix'        => $lt_message,
-  );
+    '#options' => $types,
+    '#suffix' => $lt_message,
+  ];
 
   // get the list of organisms
   $sql = "SELECT * FROM {organism}";
   $org_rset = chado_query($sql);
 
-  $organisms = array();
+  $organisms = [];
   $organisms[''] = '';
   while ($organism = $org_rset->fetchObject()) {
     $organisms[$organism->organism_id] =
-    "$organism->genus $organism->species ($organism->common_name)";
+      "$organism->genus $organism->species ($organism->common_name)";
   }
 
-  $form['organism_id'] = array(
-    '#title'       => t('Organism'),
-    '#type'        => t('select'),
+  $form['organism_id'] = [
+    '#title' => t('Organism'),
+    '#type' => t('select'),
     '#description' => t("Choose the organism with which this library is associated."),
-    '#required'    => TRUE,
+    '#required' => TRUE,
     '#default_value' => $organism_id,
-    '#options'     => $organisms,
-  );
-
-  $form['description']= array(
-    '#type'          => 'text_format',
-    '#title'         => t('Library Description'),
-    '#description'   => t('A brief description of the library'),
-    '#required'      => TRUE,
+    '#options' => $organisms,
+  ];
+
+  $form['description'] = [
+    '#type' => 'text_format',
+    '#title' => t('Library Description'),
+    '#description' => t('A brief description of the library'),
+    '#required' => TRUE,
     '#default_value' => $description,
-  );
+  ];
 
   // PROPERTIES FORM
   //---------------------------------------------
   $prop_cv = tripal_get_default_cv('libraryprop', 'type_id');
   $cv_id = $prop_cv ? $prop_cv->cv_id : NULL;
 
-  $details = array(
+  $details = [
     // The name of the prop table.
     'property_table' => 'libraryprop',
     // The value of library_id for this record.
     'chado_id' => $library_id,
     // The cv.cv_id of the cv governing libraryprop.type_id.
     'cv_id' => $cv_id,
-  );
+  ];
 
   // If the default is the 'library_property' vocabulary then we want
   // to exclude the 'Library Description' term since it has it's own form
   // element above
   if ($prop_cv->name == 'library_property') {
     // Generate our own select list so we can exclude the description element
-    $select_options = array();
-    $cv_result = chado_select_record('cv', array('cv_id'), array('name' => 'library_property'));
+    $select_options = [];
+    $cv_result = chado_select_record('cv', ['cv_id'], ['name' => 'library_property']);
     $cv_id = $cv_result[0]->cv_id;
     $select_options = tripal_get_cvterm_select_options($cv_id);
     $descrip_id = array_search('Library Description', $select_options);
@@ -205,14 +205,14 @@ function chado_library_form($node, &$form_state) {
 
   // ADDITIONAL DBXREFS FORM
   //---------------------------------------------
-  $details = array(
+  $details = [
     // The name of the _dbxref table.
     'linking_table' => 'library_dbxref',
     // The name of the key in your base chado table.
     'base_foreign_key' => 'library_id',
     // The value of library_id for this record.
-    'base_key_value' => $library_id
-  );
+    'base_key_value' => $library_id,
+  ];
   // Adds the form elements to your current form
   chado_add_node_form_dbxrefs($form, $form_state, $details);
 
@@ -232,7 +232,7 @@ function chado_library_validate($node, $form, &$form_state) {
   // Since this validate can be called on AJAX and Deletion of the node
   // we need to make this check to ensure queries are not executed
   // without the proper values.
-  if(property_exists($node, "op") and $node->op != 'Save') {
+  if (property_exists($node, "op") and $node->op != 'Save') {
     return;
   }
 
@@ -244,7 +244,7 @@ function chado_library_validate($node, $form, &$form_state) {
 
   // trim white space from text fields
   $node->libraryname = property_exists($node, 'libraryname') ? trim($node->libraryname) : '';
-  $node->uniquename  = property_exists($node, 'uniquename') ? trim($node->uniquename) : '';
+  $node->uniquename = property_exists($node, 'uniquename') ? trim($node->uniquename) : '';
 
   $lib = 0;
   // check to make sure the unique name on the library is unique
@@ -255,11 +255,14 @@ function chado_library_validate($node, $form, &$form_state) {
       FROM {library}
       WHERE uniquename = :uname AND NOT library_id = :library_id
     ";
-    $lib = chado_query($sql, array(':uname' => $node->uniquename, ':library_id' => $node->library_id))->fetchObject();
+    $lib = chado_query($sql, [
+      ':uname' => $node->uniquename,
+      ':library_id' => $node->library_id,
+    ])->fetchObject();
   }
   else {
     $sql = "SELECT * FROM {library} WHERE uniquename = :uname";
-    $lib = chado_query($sql, array(':uname' => $node->uniquename))->fetchObject();
+    $lib = chado_query($sql, [':uname' => $node->uniquename])->fetchObject();
   }
   if ($lib) {
     form_set_error('uniquename', t('The unique library name already exists. Please choose another'));
@@ -284,20 +287,20 @@ function chado_library_insert($node) {
   // we do need to proceed with insertion into the chado/drupal linking table.
   if (!property_exists($node, 'library_id')) {
     $node->libraryname = trim($node->libraryname);
-    $node->uniquename  = trim($node->uniquename);
-    $node->description  = trim($node->description['value']);
+    $node->uniquename = trim($node->uniquename);
+    $node->description = trim($node->description['value']);
 
-    $values = array(
+    $values = [
       'name' => $node->libraryname,
       'uniquename' => $node->uniquename,
       'organism_id' => $node->organism_id,
       'type_id' => $node->library_type,
-    );
+    ];
     $library = chado_insert_record('library', $values);
     if (!$library) {
       drupal_set_message(t('Unable to add library.', 'warning'));
       watchdog('tripal_library', 'Insert library: Unable to create library where values: %values',
-        array('%values' => print_r($values, TRUE)), WATCHDOG_ERROR);
+        ['%values' => print_r($values, TRUE)], WATCHDOG_ERROR);
       return;
     }
     $library_id = $library['library_id'];
@@ -305,26 +308,33 @@ function chado_library_insert($node) {
     // * Properties Form *
     // add the description property
     $properties = chado_retrieve_node_form_properties($node);
-    $descrip_id = tripal_get_cvterm(array(
+    $descrip_id = tripal_get_cvterm([
       'name' => 'Library Description',
-      'cv_id' => array('name' => 'library_property')
-    ));
+      'cv_id' => ['name' => 'library_property'],
+    ]);
     $properties[$descrip_id->cvterm_id][0] = $node->description;
 
-    $details = array(
-      'property_table' => 'libraryprop',   // the name of the prop table
-      'base_table' => 'library',           // the name of your chado base table
-      'foreignkey_name' => 'library_id',   // the name of the key in your base table
-      'foreignkey_value' => $library_id    // the value of the library_id key
-    );
+    $details = [
+      'property_table' => 'libraryprop',
+      // the name of the prop table
+      'base_table' => 'library',
+      // the name of your chado base table
+      'foreignkey_name' => 'library_id',
+      // the name of the key in your base table
+      'foreignkey_value' => $library_id
+      // the value of the library_id key
+    ];
     chado_update_node_form_properties($node, $details, $properties);
 
     // * Additional DBxrefs Form *
-    $details = array(
-      'linking_table' => 'library_dbxref',   // the name of your _dbxref table
-      'foreignkey_name' => 'library_id',     // the name of the key in your base table
-      'foreignkey_value' => $library_id      // the value of the library_id key
-    );
+    $details = [
+      'linking_table' => 'library_dbxref',
+      // the name of your _dbxref table
+      'foreignkey_name' => 'library_id',
+      // the name of the key in your base table
+      'foreignkey_value' => $library_id
+      // the value of the library_id key
+    ];
     chado_update_node_form_dbxrefs($node, $details);
 
   }
@@ -352,51 +362,58 @@ function chado_library_insert($node) {
 function chado_library_update($node) {
 
   $node->libraryname = trim($node->libraryname);
-  $node->uniquename  = trim($node->uniquename);
-  $node->description  = trim($node->description['value']);
+  $node->uniquename = trim($node->uniquename);
+  $node->description = trim($node->description['value']);
 
   // update the library record
   $library_id = chado_get_id_from_nid('library', $node->nid);
-  $match = array(
+  $match = [
     'library_id' => $library_id,
-  );
+  ];
 
-  $values = array(
-    'name'        => $node->libraryname,
-    'uniquename'  => $node->uniquename,
+  $values = [
+    'name' => $node->libraryname,
+    'uniquename' => $node->uniquename,
     'organism_id' => $node->organism_id,
-    'type_id'     => $node->library_type,
-  );
+    'type_id' => $node->library_type,
+  ];
   $status = chado_update_record('library', $match, $values);
   if (!$status) {
     drupal_set_message(t('Unable to update library.', 'warning'));
     watchdog('tripal_library', 'Update library: Unable to update library where values: %values',
-    array('%values' => print_r($values, TRUE)), WATCHDOG_ERROR);
+      ['%values' => print_r($values, TRUE)], WATCHDOG_ERROR);
   }
 
   // * Properties Form *
   // add the description property
   $properties = chado_retrieve_node_form_properties($node);
-  $descrip_id = tripal_get_cvterm(array(
+  $descrip_id = tripal_get_cvterm([
     'name' => 'Library Description',
-    'cv_id' => array('name' => 'library_property')
-  ));
+    'cv_id' => ['name' => 'library_property'],
+  ]);
   $properties[$descrip_id->cvterm_id][0] = $node->description;
 
-  $details = array(
-    'property_table' => 'libraryprop',   // the name of the prop table
-    'base_table' => 'library',           // the name of your chado base table
-    'foreignkey_name' => 'library_id',   // the name of the key in your base table
-    'foreignkey_value' => $library_id    // the value of the library_id key
-  );
+  $details = [
+    'property_table' => 'libraryprop',
+    // the name of the prop table
+    'base_table' => 'library',
+    // the name of your chado base table
+    'foreignkey_name' => 'library_id',
+    // the name of the key in your base table
+    'foreignkey_value' => $library_id
+    // the value of the library_id key
+  ];
   chado_update_node_form_properties($node, $details, $properties);
 
   // * Additional DBxrefs Form *
-  $details = array(
-    'linking_table' => 'library_dbxref',   // the name of your _dbxref table
-    'foreignkey_name' => 'library_id',     // the name of the key in your base table
-    'foreignkey_value' => $library_id      // the value of the library_id key
-  );
+  $details = [
+    'linking_table' => 'library_dbxref',
+    // the name of your _dbxref table
+    'foreignkey_name' => 'library_id',
+    // the name of the key in your base table
+    'foreignkey_value' => $library_id
+    // the value of the library_id key
+  ];
   chado_update_node_form_dbxrefs($node, $details);
 
 }
@@ -421,7 +438,7 @@ function chado_library_load($nodes) {
       continue;
     }
 
-    $values = array('library_id' => $library_id);
+    $values = ['library_id' => $library_id];
     $library = chado_generate_var('library', $values);
 
     // the uniquename field is a text field so we need to expand it
@@ -454,15 +471,15 @@ function chado_library_delete(&$node) {
   // Remove data from {chado_library}, {node} and {node_revisions} tables of
   // drupal database
   $sql_del = "DELETE FROM {chado_library} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
   $sql_del = "DELETE FROM {node_revision} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
   $sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
-  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  db_query($sql_del, [':nid' => $node->nid, ':vid' => $node->vid]);
 
   // Remove data from library and libraryprop tables of chado database as well
-  chado_query("DELETE FROM {libraryprop} WHERE library_id = :library_id", array(':library_id' => $library_id));
-  chado_query("DELETE FROM {library} WHERE library_id = :library_id", array(':library_id' => $library_id));
+  chado_query("DELETE FROM {libraryprop} WHERE library_id = :library_id", [':library_id' => $library_id]);
+  chado_query("DELETE FROM {library} WHERE library_id = :library_id", [':library_id' => $library_id]);
 }
 
 /**
@@ -470,21 +487,22 @@ function chado_library_delete(&$node) {
  *
  * This hook allows node modules to limit access to the node types they define.
  *
- *  @param $node
- *  The node on which the operation is to be performed, or, if it does not yet exist, the
- *  type of node to be created
+ * @param $node
+ *  The node on which the operation is to be performed, or, if it does not yet
+ *   exist, the type of node to be created
  *
- *  @param $op
+ * @param $op
  *  The operation to be performed
  *
- *  @param $account
- *  A user object representing the user for whom the operation is to be performed
+ * @param $account
+ *  A user object representing the user for whom the operation is to be
+ *   performed
  *
- *  @return
- *  If the permission for the specified operation is not set then return FALSE. If the
- *  permission is set then return NULL as this allows other modules to disable
- *  access.  The only exception is when the $op == 'create'.  We will always
- *  return TRUE if the permission is set.
+ * @return
+ *  If the permission for the specified operation is not set then return FALSE.
+ *   If the permission is set then return NULL as this allows other modules to
+ *   disable access.  The only exception is when the $op == 'create'.  We will
+ *   always return TRUE if the permission is set.
  *
  * @ingroup tripal_legacy_library
  */
@@ -494,7 +512,7 @@ function tripal_library_node_access($node, $op, $account) {
     $node_type = $node->type;
   }
 
-  if($node_type == 'chado_library') {
+  if ($node_type == 'chado_library') {
     if ($op == 'create') {
       if (!user_access('create chado_library content', $account)) {
         return NODE_ACCESS_DENY;
@@ -530,75 +548,75 @@ function tripal_library_node_view($node, $view_mode, $langcode) {
   switch ($node->type) {
     case 'chado_library':
       if ($view_mode == 'full') {
-        $node->content['tripal_library_base'] = array(
+        $node->content['tripal_library_base'] = [
           '#theme' => 'tripal_library_base',
           '#node' => $node,
-          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_id' => 'base',
           '#tripal_toc_title' => 'Overview',
           '#weight' => -100,
-        );
-        $node->content['tripal_library_features'] = array(
+        ];
+        $node->content['tripal_library_features'] = [
           '#theme' => 'tripal_library_features',
           '#node' => $node,
-          '#tripal_toc_id'    => 'features',
+          '#tripal_toc_id' => 'features',
           '#tripal_toc_title' => 'Features',
-        );
-        $node->content['tripal_library_properties'] = array(
+        ];
+        $node->content['tripal_library_properties'] = [
           '#theme' => 'tripal_library_properties',
           '#node' => $node,
-          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_id' => 'properties',
           '#tripal_toc_title' => 'Properties',
-        );
-        $node->content['tripal_library_publications'] = array(
+        ];
+        $node->content['tripal_library_publications'] = [
           '#theme' => 'tripal_library_publications',
           '#node' => $node,
-          '#tripal_toc_id'    => 'publications',
+          '#tripal_toc_id' => 'publications',
           '#tripal_toc_title' => 'Publications',
-        );
-        $node->content['tripal_library_references'] = array(
+        ];
+        $node->content['tripal_library_references'] = [
           '#theme' => 'tripal_library_references',
           '#node' => $node,
-          '#tripal_toc_id'    => 'references',
+          '#tripal_toc_id' => 'references',
           '#tripal_toc_title' => 'Cross References',
-        );
-        $node->content['tripal_library_synonyms'] = array(
+        ];
+        $node->content['tripal_library_synonyms'] = [
           '#theme' => 'tripal_library_synonyms',
           '#node' => $node,
-          '#tripal_toc_id'    => 'synonyms',
+          '#tripal_toc_id' => 'synonyms',
           '#tripal_toc_title' => 'Synonyms',
-        );
-        $node->content['tripal_library_terms'] = array(
+        ];
+        $node->content['tripal_library_terms'] = [
           '#theme' => 'tripal_library_terms',
           '#node' => $node,
-          '#tripal_toc_id'    => 'terms',
+          '#tripal_toc_id' => 'terms',
           '#tripal_toc_title' => 'Annotated Terms',
-        );
+        ];
       }
       if ($view_mode == 'teaser') {
-        $node->content['tripal_library_teaser'] = array(
+        $node->content['tripal_library_teaser'] = [
           '#theme' => 'tripal_library_teaser',
           '#node' => $node,
-        );
+        ];
       }
       break;
     case 'chado_organism':
       if ($view_mode == 'full') {
-        $node->content['tripal_organism_libraries'] = array(
+        $node->content['tripal_organism_libraries'] = [
           '#theme' => 'tripal_organism_libraries',
           '#node' => $node,
-          '#tripal_toc_id'    => 'libraries',
+          '#tripal_toc_id' => 'libraries',
           '#tripal_toc_title' => 'Libraries',
-        );
+        ];
       }
       break;
     case 'chado_feature':
       if ($view_mode == 'full') {
-        $node->content['tripal_feature_libraries'] = array(
+        $node->content['tripal_feature_libraries'] = [
           '#theme' => 'tripal_feature_libraries',
           '#node' => $node,
-          '#tripal_toc_id'    => 'libraries',
+          '#tripal_toc_id' => 'libraries',
           '#tripal_toc_title' => 'Libraries',
-        );
+        ];
       }
       break;
   }
@@ -625,8 +643,10 @@ function tripal_library_node_presave($node) {
         // set the title
         $node->title = $node->libraryname;
       }
-      else if (property_exists($node, 'library')) {
-        $node->title = $node->library->name;
+      else {
+        if (property_exists($node, 'library')) {
+          $node->title = $node->library->name;
+        }
       }
       break;
   }
@@ -644,7 +664,7 @@ function tripal_library_node_insert($node) {
     case 'chado_library':
 
       $library_id = chado_get_id_from_nid('library', $node->nid);
-      $values = array('library_id' => $library_id);
+      $values = ['library_id' => $library_id];
       $library = chado_generate_var('library', $values);
       $library = chado_expand_var($library, 'field', 'library.uniquename');
       $node->library = $library;

+ 30 - 26
legacy/tripal_library/theme/templates/tripal_feature_libraries.tpl.php

@@ -3,65 +3,69 @@ $feature = $variables['node']->feature;
 
 // expand the feature object to include the libraries from the library
 // table in chado.
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $feature = chado_expand_var($feature, 'table', 'library_feature', $options);
 $library_features = $feature->library_feature;
 
 
-if (count($library_features) > 0) {?>
-  <div class="tripal_feature-data-block-desc tripal-data-block-desc">The following libraries are associated with this feature.</div> <?php 
-  
+if (count($library_features) > 0) { ?>
+    <div class="tripal_feature-data-block-desc tripal-data-block-desc">The
+        following libraries are associated with this feature.
+    </div> <?php
+
   // the $headers array is an array of fields to use as the colum headers. 
   // additional documentation can be found here 
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
   // This table for the analysis has a vertical header (down the first column)
   // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array('Library Name', 'Type');
-  
+  $headers = ['Library Name', 'Type'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
-  foreach ($library_features as $library_feature){ 
-    
+  $rows = [];
+  foreach ($library_features as $library_feature) {
+
     $libname = $library_feature->library_id->name;
     if ($library_feature->library_id->nid) {
-      $libname = l($libname, "node/" . $library_feature->library_id->nid, array('attributes' => array('target' => '_blank')));
+      $libname = l($libname, "node/" . $library_feature->library_id->nid, ['attributes' => ['target' => '_blank']]);
     }
-    
+
     $typename = $library_feature->library_id->type_id->name;
     if ($typename == 'cdna_library') {
       $typename = 'cDNA';
     }
-    else if ($typename == 'bac_library') {
-      $typename = 'BAC';
+    else {
+      if ($typename == 'bac_library') {
+        $typename = 'BAC';
+      }
     }
-    
-    $rows[] = array(
+
+    $rows[] = [
       $libname,
-      $typename
-    );      
+      $typename,
+    ];
   }
-  
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_feature-table-libraries',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table); 
+  print theme_table($table);
 }

+ 49 - 49
legacy/tripal_library/theme/templates/tripal_library_base.tpl.php

@@ -1,86 +1,86 @@
 <?php
 
-$library  = $variables['node']->library;
+$library = $variables['node']->library;
 
 // get the library description. IT uses a tern name of 'Library Description'
-$record = array(
+$record = [
   'table' => 'library',
-  'id' => $library->library_id
-);
-$property = array(
+  'id' => $library->library_id,
+];
+$property = [
   'type_name' => 'Library Description',
-  'cv_name' => 'library_property'
-);
+  'cv_name' => 'library_property',
+];
 $libprop = chado_get_property($record, $property);
 $description = isset($libprop->value) ? $libprop->value : ''; ?>
 
-<div class="tripal_library-data-block-desc tripal-data-block-desc"></div> <?php 
+    <div class="tripal_library-data-block-desc tripal-data-block-desc"></div> <?php
 
 // the $headers array is an array of fields to use as the colum headers. 
 // additional documentation can be found here 
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
 // This table for the library has a vertical header (down the first column)
 // so we do not provide headers here, but specify them in the $rows array below.
-$headers = array();
+$headers = [];
 
 // the $rows array contains an array of rows where each row is an array
 // of values for each column of the table in that row.  Additional documentation
 // can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-$rows = array();
+$rows = [];
 
 // Name row
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Library Name',
     'header' => TRUE,
     'width' => '20%',
-  ),
-  $library->name
-);
+  ],
+  $library->name,
+];
 
 // Unique row
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Unique Name',
-    'header' => TRUE
-  ),
-  $library->uniquename
-);
+    'header' => TRUE,
+  ],
+  $library->uniquename,
+];
 
 // Organism row
-$organism = $library->organism_id->genus ." " . $library->organism_id->species ." (" .$library->organism_id->common_name .")";
+$organism = $library->organism_id->genus . " " . $library->organism_id->species . " (" . $library->organism_id->common_name . ")";
 if (property_exists($library->organism_id, 'nid')) {
-  $organism = l("<i>" . $library->organism_id->genus . " " . $library->organism_id->species . "</i> (" .$library->organism_id->common_name .")", "node/".$library->organism_id->nid, array('html' => TRUE));
-} 
-$rows[] = array(
-  array(
+  $organism = l("<i>" . $library->organism_id->genus . " " . $library->organism_id->species . "</i> (" . $library->organism_id->common_name . ")", "node/" . $library->organism_id->nid, ['html' => TRUE]);
+}
+$rows[] = [
+  [
     'data' => 'Organism',
-    'header' => TRUE
-  ),
-  $organism
-);
+    'header' => TRUE,
+  ],
+  $organism,
+];
 
 // Library Type row
-$rows[] = array(
-  array(
+$rows[] = [
+  [
     'data' => 'Type',
-    'header' => TRUE
-  ),
+    'header' => TRUE,
+  ],
   $library->type_id->name,
-);
+];
 
 // allow site admins to see the library ID
 if (user_access('view ids')) {
   // Library ID
-  $rows[] = array(
-    array(
-      'data'   => 'Library ID',
+  $rows[] = [
+    [
+      'data' => 'Library ID',
       'header' => TRUE,
-      'class'  => 'tripal-site-admin-only-table-row',
-    ),
+      'class' => 'tripal-site-admin-only-table-row',
+    ],
     $library->library_id,
-  );
+  ];
 }
 
 
@@ -88,25 +88,25 @@ if (user_access('view ids')) {
 // options for controlling the display of the table.  Additional
 // documentation can be found here:
 // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-$table = array(
+$table = [
   'header' => $headers,
   'rows' => $rows,
-  'attributes' => array(
+  'attributes' => [
     'id' => 'tripal_library-table-base',
-    'class' => 'tripal-data-table'
-  ),
+    'class' => 'tripal-data-table',
+  ],
   'sticky' => FALSE,
   'caption' => '',
-  'colgroups' => array(),
+  'colgroups' => [],
   'empty' => '',
-);
+];
 
 // once we have our table array structure defined, we call Drupal's theme_table()
 // function to generate the table.
-print theme_table($table); 
+print theme_table($table);
 
 // now add in the description below the table if one exists
 if ($description) { ?>
-  <div style="text-align: justify"><?php print $description; ?></div> <?php  
+    <div style="text-align: justify"><?php print $description; ?></div> <?php
 }
 

+ 39 - 36
legacy/tripal_library/theme/templates/tripal_library_features.tpl.php

@@ -9,73 +9,76 @@ $library = $variables['node']->library;
 // on and retrieves the proper set of features
 $element = 0;        // an index to specify the pager if more than one is on the page
 $num_per_page = 25;  // the number of features to show per page
-$values = array(
+$values = [
   'library_id' => $library->library_id,
-);
-$columns = array('feature_id');
-$options = array(
-  'pager' => array(
+];
+$columns = ['feature_id'];
+$options = [
+  'pager' => [
     'limit' => $num_per_page,
-    'element' => $element
-   ),
-);
+    'element' => $element,
+  ],
+];
 $results = chado_select_record('library_feature', $columns, $values, $options);
 
 // now that we have all of the feature IDs, we want to expand each one so that we
 // have all of the neccessary values, including the node ID, if one exists, and the
 // cvterm type name.
-$features = array();
+$features = [];
 foreach ($results as $library_feature) {
-  $values = array('feature_id' => $library_feature->feature_id);
-  $options = array(
-    'include_fk' => array(
-      'type_id' => 1
-    )
-  );
+  $values = ['feature_id' => $library_feature->feature_id];
+  $options = [
+    'include_fk' => [
+      'type_id' => 1,
+    ],
+  ];
   $features[] = chado_generate_var('feature', $values, $options);
 }
 
 if (count($features) > 0) { ?>
-  <div class="tripal_library-data-block-desc tripal-data-block-desc">The following browser provides a quick view for new visitors.  Use the searching mechanism to find specific features.</div> <?php
+    <div class="tripal_library-data-block-desc tripal-data-block-desc">The
+        following browser provides a quick view for new visitors. Use the
+        searching mechanism to find specific features.
+    </div> <?php
 
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Feature Name' ,'Unique Name', 'Type');
+  $headers = ['Feature Name', 'Unique Name', 'Type'];
 
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
+  $rows = [];
 
-  foreach ($features as $feature){
-    $fname =  $feature->name;
+  foreach ($features as $feature) {
+    $fname = $feature->name;
     if (property_exists($feature, 'nid')) {
-      $fname =   l($fname, "node/$feature->nid", array('attributes' => array('target' => '_blank')));
+      $fname = l($fname, "node/$feature->nid", ['attributes' => ['target' => '_blank']]);
     }
-    $rows[] = array(
+    $rows[] = [
       $fname,
       $feature->uniquename,
-      $feature->type_id->name
-    );
+      $feature->type_id->name,
+    ];
   }
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_library-table-features',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
+  ];
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
   print theme_table($table);
@@ -90,14 +93,14 @@ if (count($features) > 0) { ?>
   // Drupal won't reset the parameter if it already exists.
   $get = $_GET;
   unset($_GET['pane']);
-  $pager = array(
-    'tags' => array(),
+  $pager = [
+    'tags' => [],
     'element' => $element,
-    'parameters' => array(
-      'pane' => 'features'
-    ),
+    'parameters' => [
+      'pane' => 'features',
+    ],
     'quantity' => $num_per_page,
-  );
+  ];
   print theme_pager($pager);
   $_GET = $get;
 }

+ 35 - 17
legacy/tripal_library/theme/templates/tripal_library_help.tpl.php

@@ -1,28 +1,46 @@
 <h3>Module Description:</h3>
-<p>The Tripal Library module is an interface for the Chado Library module which groups features (sequences) into genetic libraries.
-    This module provides support for visualization of "library" pages, editing and updating.</p>
+<p>The Tripal Library module is an interface for the Chado Library module which
+    groups features (sequences) into genetic libraries.
+    This module provides support for visualization of "library" pages, editing
+    and updating.</p>
 
 <h3>Setup Instructions:</h3>
 <ol>
-  <li><p><b>Set Permissions</b>: By default only the site administrator account has access to create, edit, delete
-   or administer features. Navigate to the <?php print l('permissions page', 'admin/user/permissions')?> and set the
-   permissions under the 'tripal_library' section as appropriate for your site. For a simple setup, allow anonymous 
-   users access to view content and create a special role for creating, editing and other administrative tasks.</p></li>
+    <li><p><b>Set Permissions</b>: By default only the site administrator
+            account has access to create, edit, delete
+            or administer features. Navigate to
+            the <?php print l('permissions page', 'admin/user/permissions') ?>
+            and set the
+            permissions under the 'tripal_library' section as appropriate for
+            your site. For a simple setup, allow anonymous
+            users access to view content and create a special role for creating,
+            editing and other administrative tasks.</p></li>
 
-<li><p><b>Sync any Existing Libraries</b>: Near the top of the <?php  l('Library Configuration page', 'admin/tripal/tripal_library/configuration') ?> there is
-  a Sync Libraries section which provides list of libraries currently in chado which can be synced.
-  Simply select the libraries you would like to create Drupal/Tripal pages for and click Sync Libraries.</p></li>
+    <li><p><b>Sync any Existing Libraries</b>: Near the top of
+            the <?php l('Library Configuration page', 'admin/tripal/tripal_library/configuration') ?>
+            there is
+            a Sync Libraries section which provides list of libraries currently
+            in chado which can be synced.
+            Simply select the libraries you would like to create Drupal/Tripal
+            pages for and click Sync Libraries.</p></li>
 </ol>
 
 
 <h3>Features of this Module:</h3>
 <ul>
-  <li><b>Add/Edit/Delete Libraries</b>: Libraries with no associated features can be created <?php print l('here', 'node/add/chado-library') ?>.  
-  Existing Libraries (regardless of the method used to create them) can be
-  edited or deleted by clicking the Edit tab at the top of the Library Page.</li>
-  
-    <li><p><b>Simple Search Tool</b>: A <?php print l('simple search tool','chado/libraries') ?> is provided for 
-    finding libraries. This tool relies on Drupal Views.  <a href="http://drupal.org/project/views">Drupal Views</a>
-    which must be installed to see the search tool.  Look for it in the navigation menu under the item 
-    "Search Data". </p></li>
+    <li><b>Add/Edit/Delete Libraries</b>: Libraries with no associated features
+        can be created <?php print l('here', 'node/add/chado-library') ?>.
+        Existing Libraries (regardless of the method used to create them) can be
+        edited or deleted by clicking the Edit tab at the top of the Library
+        Page.
+    </li>
+
+    <li><p><b>Simple Search Tool</b>:
+            A <?php print l('simple search tool', 'chado/libraries') ?> is
+            provided for
+            finding libraries. This tool relies on Drupal Views. <a
+                    href="http://drupal.org/project/views">Drupal Views</a>
+            which must be installed to see the search tool. Look for it in the
+            navigation menu under the item
+            "Search Data". </p></li>
 </ul>

+ 20 - 20
legacy/tripal_library/theme/templates/tripal_library_properties.tpl.php

@@ -1,7 +1,7 @@
 <?php
 
 $library = $variables['node']->library;
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $library = chado_expand_var($library, 'table', 'libraryprop', $options);
 $props = $library->libraryprop;
 if (!$props) {
@@ -10,7 +10,7 @@ if (!$props) {
 
 // iterate through the properties and remove the 'library_description' as it is
 // already displayed on the base template.
-$properties = array();
+$properties = [];
 foreach ($props as $prop) {
   if ($prop->type_id->name == 'Library Description') {
     continue;
@@ -18,44 +18,44 @@ foreach ($props as $prop) {
   $properties[] = $prop;
 }
 
-if(count($properties) > 0){ 
+if (count($properties) > 0) {
 
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Property Name', 'Value');
-  
+  $headers = ['Property Name', 'Value'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
-  
-  foreach ($properties as $property){
-    $property = chado_expand_var($property,'field','libraryprop.value');
-    $rows[] = array(
+  $rows = [];
+
+  foreach ($properties as $property) {
+    $property = chado_expand_var($property, 'field', 'libraryprop.value');
+    $rows[] = [
       ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
-      urldecode($property->value)
-    );
+      urldecode($property->value),
+    ];
   }
-   
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_library-table-properties',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
   print theme_table($table);

+ 39 - 34
legacy/tripal_library/theme/templates/tripal_library_publications.tpl.php

@@ -2,81 +2,86 @@
 $library = $variables['node']->library;
 
 // expand library to include pubs 
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $library = chado_expand_var($library, 'table', 'library_pub', $options);
-$library_pubs = $library->library_pub; 
+$library_pubs = $library->library_pub;
 
 
 if (count($library_pubs) > 0) { ?>
-  <div class="tripal_library_pub-data-block-desc tripal-data-block-desc"></div> <?php 
+    <div class="tripal_library_pub-data-block-desc tripal-data-block-desc"></div> <?php
 
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Year', 'Publication');
-  
+  $headers = ['Year', 'Publication'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
-  
+  $rows = [];
+
   foreach ($library_pubs as $library_pub) {
     $pub = $library_pub->pub_id;
     $pub = chado_expand_var($pub, 'field', 'pub.title');
     $citation = $pub->title;  // use the title as the default citation
-    
+
     // get the citation for this pub if it exists
-    $values = array(
-      'pub_id' => $pub->pub_id, 
-      'type_id' => array(
+    $values = [
+      'pub_id' => $pub->pub_id,
+      'type_id' => [
         'name' => 'Citation',
-      ),
-    );
-    $options = array('return_array' => 1);
-    $citation_prop = chado_generate_var('pubprop', $values, $options); 
+      ],
+    ];
+    $options = ['return_array' => 1];
+    $citation_prop = chado_generate_var('pubprop', $values, $options);
     if (count($citation_prop) == 1) {
       $citation_prop = chado_expand_var($citation_prop, 'field', 'pubprop.value');
       $citation = $citation_prop[0]->value;
     }
-    
+
     // if the publication is synced then link to it
     if ($pub->nid) {
       // replace the title with a link
-      $link = l($pub->title, 'node/' . $pub->nid ,array('attributes' => array('target' => '_blank')));
-      $patterns = array(
-        '/(\()/', '/(\))/',
-        '/(\])/', '/(\[)/',
-        '/(\{)/', '/(\})/',
-        '/(\+)/', '/(\.)/', '/(\?)/',
-      );
+      $link = l($pub->title, 'node/' . $pub->nid, ['attributes' => ['target' => '_blank']]);
+      $patterns = [
+        '/(\()/',
+        '/(\))/',
+        '/(\])/',
+        '/(\[)/',
+        '/(\{)/',
+        '/(\})/',
+        '/(\+)/',
+        '/(\.)/',
+        '/(\?)/',
+      ];
       $fixed_title = preg_replace($patterns, "\\\\$1", $pub->title);
       $citation = preg_replace('/' . $fixed_title . '/', $link, $citation);
     }
-    
-    $rows[] = array(
+
+    $rows[] = [
       $pub->pyear,
       $citation,
-    );
+    ];
   }
-  
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_library-table-publications',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
   print theme_table($table);

+ 34 - 33
legacy/tripal_library/theme/templates/tripal_library_references.tpl.php

@@ -1,66 +1,67 @@
 <?php
 $library = $variables['node']->library;
-$references = array();
+$references = [];
 
 // Second, expand the library object to include the records from the library_dbxref table
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $library = chado_expand_var($library, 'table', 'library_dbxref', $options);
 $library_dbxrefs = $library->library_dbxref;
-if (count($library_dbxrefs) > 0 ) {
-  foreach ($library_dbxrefs as $library_dbxref) {    
+if (count($library_dbxrefs) > 0) {
+  foreach ($library_dbxrefs as $library_dbxref) {
     $references[] = $library_dbxref->dbxref_id;
   }
 }
 
 
-if(count($references) > 0){ ?>
-  <div class="tripal_library-data-block-desc tripal-data-block-desc">External references for this <?php print $library->type_id->name ?></div><?php
-   
+if (count($references) > 0) { ?>
+    <div class="tripal_library-data-block-desc tripal-data-block-desc">External
+    references for this <?php print $library->type_id->name ?></div><?php
+
   // the $headers array is an array of fields to use as the colum headers.
   // additional documentation can be found here
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $headers = array('Database', 'Accession');
-  
+  $headers = ['Database', 'Accession'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $rows = array();
+  $rows = [];
+
+  foreach ($references as $dbxref) {
+
+    $dbname = $dbxref->db_id->name;
+    if ($dbxref->db_id->url) {
+      $dbname = l($dbname, $dbxref->db_id->url, ['attributes' => ['target' => '_blank']]);
+    }
 
-  foreach ($references as $dbxref){
-   
-    $dbname = $dbxref->db_id->name; 
-    if ($dbxref->db_id->url) { 
-      $dbname = l($dbname, $dbxref->db_id->url, array('attributes' => array('target' => '_blank')));
-    } 
-    
-    $accession = $dbxref->accession; 
-    if ($dbxref->db_id->urlprefix) { 
-      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
-    } 
-    $rows[] = array(
+    $accession = $dbxref->accession;
+    if ($dbxref->db_id->urlprefix) {
+      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, ['attributes' => ['target' => '_blank']]);
+    }
+    $rows[] = [
       $dbname,
-      $accession
-    );
-  } 
-  
+      $accession,
+    ];
+  }
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_library-table-references',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
   print theme_table($table);

+ 23 - 21
legacy/tripal_library/theme/templates/tripal_library_synonyms.tpl.php

@@ -3,49 +3,51 @@ $library = $variables['node']->library;
 
 // expand the library object to include the synonyms from the library_synonym 
 // table in chado.
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $library = chado_expand_var($library, 'table', 'library_synonym', $options);
 $synonyms = $library->library_synonym;
 
-if(count($synonyms) > 0){ ?>
-  <div class="tripal_library-data-block-desc tripal-data-block-desc">The library '<?php print $library->name ?>' has the following synonyms</div><?php
-  
+if (count($synonyms) > 0) { ?>
+    <div class="tripal_library-data-block-desc tripal-data-block-desc">The
+    library '<?php print $library->name ?>' has the following
+    synonyms</div><?php
+
   // the $headers array is an array of fields to use as the colum headers. 
   // additional documentation can be found here 
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
   // This table for the analysis has a vertical header (down the first column)
   // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array('Synonym');
-  
+  $headers = ['Synonym'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
-  foreach ($synonyms as $library_synonym){
-    $rows[] = array(
-      $library_synonym->synonym_id->name
-    );
-  } 
-  
+  $rows = [];
+  foreach ($synonyms as $library_synonym) {
+    $rows[] = [
+      $library_synonym->synonym_id->name,
+    ];
+  }
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_library-table-synonyms',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table); 
+  print theme_table($table);
 }

+ 17 - 17
legacy/tripal_library/theme/templates/tripal_library_teaser.tpl.php

@@ -1,27 +1,27 @@
 <?php
-$node    = $variables['node'];
+$node = $variables['node'];
 $library = $variables['node']->library;
 
 // get the library description. IT uses a tern name of 'Library Description'
-$record = array(
+$record = [
   'table' => 'library',
-  'id' => $library->library_id
-);
-$property = array(
+  'id' => $library->library_id,
+];
+$property = [
   'type_name' => 'Library Description',
-  'cv_name' => 'library_property'
-);
+  'cv_name' => 'library_property',
+];
 $libprop = chado_get_property($record, $property);
 $description = $libprop->value; ?>
 
-<div class="tripal_library-teaser tripal-teaser"> 
-  <div class="tripal-library-teaser-title tripal-teaser-title"><?php 
-    print l($node->title, "node/$node->nid", array('html' => TRUE));?>
-  </div>
-  <div class="tripal-library-teaser-text tripal-teaser-text"><?php 
-    print substr($description, 0, 650);
-    if (strlen($description) > 650) {
-      print "... " . l("[more]", "node/$node->nid");
-    } ?>
-  </div>
+<div class="tripal_library-teaser tripal-teaser">
+    <div class="tripal-library-teaser-title tripal-teaser-title"><?php
+      print l($node->title, "node/$node->nid", ['html' => TRUE]); ?>
+    </div>
+    <div class="tripal-library-teaser-text tripal-teaser-text"><?php
+      print substr($description, 0, 650);
+      if (strlen($description) > 650) {
+        print "... " . l("[more]", "node/$node->nid");
+      } ?>
+    </div>
 </div>

+ 28 - 25
legacy/tripal_library/theme/templates/tripal_library_terms.tpl.php

@@ -2,67 +2,70 @@
 
 $library = $variables['node']->library;
 
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $library = chado_expand_var($library, 'table', 'library_cvterm', $options);
 $terms = $library->library_cvterm;
 
 // order the terms by CV
-$s_terms = array();
+$s_terms = [];
 if ($terms) {
   foreach ($terms as $term) {
-    $s_terms[$term->cvterm_id->cv_id->name][] = $term;  
+    $s_terms[$term->cvterm_id->cv_id->name][] = $term;
   }
 }
 
 if (count($s_terms) > 0) { ?>
-  <div class="tripal_library-data-block-desc tripal-data-block-desc">The following terms have been associated with this <?php print $node->library->type_id->name ?>:</div>  <?php
-  
+    <div class="tripal_library-data-block-desc tripal-data-block-desc">The
+        following terms have been associated with
+        this <?php print $node->library->type_id->name ?>:
+    </div>  <?php
+
   // iterate through each term
   $i = 0;
-  foreach ($s_terms as $cv => $terms) {  
+  foreach ($s_terms as $cv => $terms) {
     // the $headers array is an array of fields to use as the colum headers.
     // additional documentation can be found here
     // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Term', 'Definition');
-    
+    $headers = ['Term', 'Definition'];
+
     // the $rows array contains an array of rows where each row is an array
     // of values for each column of the table in that row.  Additional documentation
     // can be found here:
     // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $rows = array();
-    
-    foreach ($terms as $term) { 
+    $rows = [];
+
+    foreach ($terms as $term) {
 
       $accession = $term->cvterm_id->dbxref_id->accession;
       if (is_numeric($term->cvterm_id->dbxref_id->accession)) {
         $accession = $term->cvterm_id->dbxref_id->db_id->name . ":" . $term->cvterm_id->dbxref_id->accession;
       }
       if ($term->cvterm_id->dbxref_id->db_id->urlprefix) {
-        $accession = l($accession, $term->cvterm_id->dbxref_id->db_id->urlprefix . $accession, array('attributes' => array("target" => '_blank')));
-      } 
-      
-      $rows[] = array(
+        $accession = l($accession, $term->cvterm_id->dbxref_id->db_id->urlprefix . $accession, ['attributes' => ["target" => '_blank']]);
+      }
+
+      $rows[] = [
         $accession,
-        $term->cvterm_id->name
-      );
-    } 
+        $term->cvterm_id->name,
+      ];
+    }
     // the $table array contains the headers and rows array as well as other
     // options for controlling the display of the table.  Additional
     // documentation can be found here:
     // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $table = array(
+    $table = [
       'header' => $headers,
       'rows' => $rows,
-      'attributes' => array(
+      'attributes' => [
         'id' => "tripal_library-table-terms-$i",
-        'class' => 'tripal-data-table'
-      ),
+        'class' => 'tripal-data-table',
+      ],
       'sticky' => FALSE,
       'caption' => '<b>Vocabulary: ' . ucwords(preg_replace('/_/', ' ', $cv)) . '</b>',
-      'colgroups' => array(),
+      'colgroups' => [],
       'empty' => '',
-    );
-    
+    ];
+
     // once we have our table array structure defined, we call Drupal's theme_table()
     // function to generate the table.
     print theme_table($table);

+ 30 - 26
legacy/tripal_library/theme/templates/tripal_organism_libraries.tpl.php

@@ -3,67 +3,71 @@ $organism = $variables['node']->organism;
 
 // expand the organism object to include the libraries from the library
 // table in chado.
-$options = array('return_array' => 1);
+$options = ['return_array' => 1];
 $organism = chado_expand_var($organism, 'table', 'library', $options);
 $libraries = $organism->library;
 
 
-if (count($libraries) > 0) {?>
-  <div class="tripal_organism-data-block-desc tripal-data-block-desc">The following libraries are associated with this organism.</div> <?php 
-  
+if (count($libraries) > 0) { ?>
+    <div class="tripal_organism-data-block-desc tripal-data-block-desc">The
+        following libraries are associated with this organism.
+    </div> <?php
+
   // the $headers array is an array of fields to use as the colum headers. 
   // additional documentation can be found here 
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
   // This table for the analysis has a vertical header (down the first column)
   // so we do not provide headers here, but specify them in the $rows array below.
-  $headers = array('Library Name', 'Type');
-  
+  $headers = ['Library Name', 'Type'];
+
   // the $rows array contains an array of rows where each row is an array
   // of values for each column of the table in that row.  Additional documentation
   // can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
-  $rows = array();
-  foreach ($libraries as $library){ 
-    
+  $rows = [];
+  foreach ($libraries as $library) {
+
     $libname = $library->name;
     if (isset($library->nid)) {
-      $libname = l($libname, "node/".$library->nid, array('attributes' => array('target' => '_blank')));
+      $libname = l($libname, "node/" . $library->nid, ['attributes' => ['target' => '_blank']]);
     }
-    
+
     $typename = $library->type_id->name;
     if ($typename == 'cdna_library') {
       $typename = 'cDNA';
     }
-    else if ($typename == 'bac_library') {
-      $typename = 'BAC';
+    else {
+      if ($typename == 'bac_library') {
+        $typename = 'BAC';
+      }
     }
-    
-    $rows[] = array(
+
+    $rows[] = [
       $libname,
-      $typename
-    );      
+      $typename,
+    ];
   }
-  
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
   // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-  $table = array(
+  $table = [
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(
+    'attributes' => [
       'id' => 'tripal_organism-table-libraries',
-      'class' => 'tripal-data-table'
-    ),
+      'class' => 'tripal-data-table',
+    ],
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(),
+    'colgroups' => [],
     'empty' => '',
-  );
-  
+  ];
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table); 
+  print theme_table($table);
 }
 
 

+ 35 - 35
legacy/tripal_library/tripal_library.views_default.inc

@@ -10,7 +10,7 @@
  * @ingroup tripal_legacy_library
  */
 function tripal_library_views_default_views() {
-  $views = array();
+  $views = [];
 
   // User View ("Search Biological Content")
   // Remember, if you change the name/path of this view,
@@ -46,12 +46,12 @@ function tripal_library_defaultvalue_user_library() {
 
   // Change the path
   $view->display['page_1']->display_options['path'] = 'chado/library';
-  $view->display['page_1']->display_options['menu'] = array(
+  $view->display['page_1']->display_options['menu'] = [
     'type' => 'normal',
     'title' => 'Libraries',
     'description' => 'Biological library including BAC, cDNA, FOSMID, etc.',
-    'weight' => '-10'
-  );
+    'weight' => '-10',
+  ];
   unset($view->display['page_1']->display_options['tab_options']);
 
   // Change the permission
@@ -106,58 +106,58 @@ function tripal_library_admin_defaultviews_library() {
   $handler->display->display_options['pager']['options']['quantity'] = '9';
   $handler->display->display_options['style_plugin'] = 'table';
   $handler->display->display_options['style_options']['grouping'] = '';
-  $handler->display->display_options['style_options']['columns'] = array(
+  $handler->display->display_options['style_options']['columns'] = [
     'uniquename' => 'uniquename',
     'name_1' => 'name_1',
     'common_name' => 'common_name',
     'name' => 'name',
     'is_obsolete' => 'is_obsolete',
-  );
+  ];
   $handler->display->display_options['style_options']['default'] = 'uniquename';
-  $handler->display->display_options['style_options']['info'] = array(
-    'uniquename' => array(
+  $handler->display->display_options['style_options']['info'] = [
+    'uniquename' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'name_1' => array(
+    ],
+    'name_1' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'common_name' => array(
+    ],
+    'common_name' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'name' => array(
+    ],
+    'name' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-    'is_obsolete' => array(
+    ],
+    'is_obsolete' => [
       'sortable' => 1,
       'separator' => '',
-    ),
-  );
+    ],
+  ];
   /* Header: Global: Action Links */
   $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
   $handler->display->display_options['header']['action_links_area']['table'] = 'views';
   $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
   $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
   $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
-  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+  $handler->display->display_options['header']['action_links_area']['link-1'] = [
     'label-1' => 'Add Library',
     'path-1' => 'node/add/tripal-library',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-2'] = [
     'label-2' => '',
     'path-2' => '',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-3'] = [
     'label-3' => '',
     'path-3' => '',
-  );
-  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
+  ];
+  $handler->display->display_options['header']['action_links_area']['link-4'] = [
     'label-4' => '',
     'path-4' => '',
-  );
+  ];
   /* No results behavior: Global: Text area */
   $handler->display->display_options['empty']['text']['id'] = 'area';
   $handler->display->display_options['empty']['text']['table'] = 'views';
@@ -253,11 +253,11 @@ function tripal_library_admin_defaultviews_library() {
   $handler->display->display_options['filters']['common_name']['expose']['label'] = 'Organism';
   $handler->display->display_options['filters']['common_name']['expose']['operator'] = 'common_name_op';
   $handler->display->display_options['filters']['common_name']['expose']['identifier'] = 'organism_common_name';
-  $handler->display->display_options['filters']['common_name']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['common_name']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
   /* Filter criterion: Chado Library: Type Id */
   $handler->display->display_options['filters']['type_id']['id'] = 'type_id';
   $handler->display->display_options['filters']['type_id']['table'] = 'library';
@@ -268,11 +268,11 @@ function tripal_library_admin_defaultviews_library() {
   $handler->display->display_options['filters']['type_id']['expose']['label'] = 'Type';
   $handler->display->display_options['filters']['type_id']['expose']['operator'] = 'type_id_op';
   $handler->display->display_options['filters']['type_id']['expose']['identifier'] = 'type_id';
-  $handler->display->display_options['filters']['type_id']['expose']['remember_roles'] = array(
+  $handler->display->display_options['filters']['type_id']['expose']['remember_roles'] = [
     2 => '2',
     1 => 0,
     3 => 0,
-  );
+  ];
 
   /** MANUALLY ADD since filter handler no exporting correctly */
   $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'select';
@@ -293,11 +293,11 @@ function tripal_library_admin_defaultviews_library() {
   $handler->display->display_options['tab_options']['weight'] = '0';
 
   /** MANUALLY ADD since filter handler no exporting correctly
-  $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'select';
-  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
-  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
-  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
-  */
+   * $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'select';
+   * $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+   * $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
+   * $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+   */
 
   return $view;
 }

+ 3 - 3
legacy/tripal_natural_diversity/includes/tripal_natural_diversity.admin.inc

@@ -13,7 +13,7 @@ function tripal_natural_diversity_admin_natdiv_view() {
   $output = '';
 
   // set the breadcrumb
-  $breadcrumb = array();
+  $breadcrumb = [];
   $breadcrumb[] = l('Home', '<front>');
   $breadcrumb[] = l('Administration', 'admin');
   $breadcrumb[] = l('Tripal', 'admin/tripal');
@@ -22,7 +22,7 @@ function tripal_natural_diversity_admin_natdiv_view() {
   drupal_set_breadcrumb($breadcrumb);
 
   // Add the view
-  $view = views_embed_view('tripal_natural_diversity_admin_natdiv_exp','default');
+  $view = views_embed_view('tripal_natural_diversity_admin_natdiv_exp', 'default');
   if (isset($view)) {
     $output .= $view;
   }
@@ -32,7 +32,7 @@ function tripal_natural_diversity_admin_natdiv_view() {
       . 'administrative interface are disabled. <strong>Click each of the following links to '
       . 'enable the pertinent views</strong>:</p>';
     $output .= '<ul>';
-      $output .= '<li>'.l('Natural Diversity Experiments Admin', 'admin/tripal/legacy/tripal_natdiv/views/natdiv_exp/enable').'</li>';
+    $output .= '<li>' . l('Natural Diversity Experiments Admin', 'admin/tripal/legacy/tripal_natdiv/views/natdiv_exp/enable') . '</li>';
     $output .= '</ul>';
   }
 

Some files were not shown because too many files changed in this diff