Browse Source

Merge branch '7.x-3.x' into 7.x-3.x-dashboard

Shawna Spoor 7 years ago
parent
commit
732c12b4dd

+ 1 - 1
legacy/tripal_library/theme/templates/tripal_organism_libraries.tpl.php

@@ -26,7 +26,7 @@ if (count($libraries) > 0) {?>
   foreach ($libraries as $library){ 
     
     $libname = $library->name;
-    if ($library->nid) {
+    if (isset($library->nid)) {
       $libname = l($libname, "node/".$library->nid, array('attributes' => array('target' => '_blank')));
     }
     

+ 4 - 0
tripal/includes/TripalBundleUIController.inc

@@ -177,6 +177,10 @@ function tripal_tripal_bundle_form($form, &$form_state, $entityDataType) {
     '#weight' => 99,
   );
 
+  // TODO: (Shawna) Add in form elements to allow the site admin
+  // to set if fields should be shown by defulat if empty.
+  // Tripal default should always be to hide fields if there are no values.
+
   // Set Title Format.
   //-------------------------
   $title_format = tripal_get_title_format($bundle);

+ 2 - 2
tripal/includes/TripalFields/TripalField.inc

@@ -264,8 +264,8 @@ class TripalField {
   }
   /**
    *
-   * @param unknown $form
-   * @param unknown $form_state
+   * @param $form
+   * @param $form_state
    */
   public function settingsFormValidate($form, &$form_state) {
 

+ 21 - 1
tripal/includes/tripal.fields.inc

@@ -228,6 +228,11 @@ function tripal_field_formatter_view($entity_type, $entity, $field,
     return;
   }
 
+  // TODO: (Shawna) 1) Check the entity type (bundle) settings to see if empty fieleds
+  // should be ignored by default. 2)  Check the field itself to see if it
+  // overides the bundle default.  The idea being do not show fields when
+  // people don't want them shown.
+
   $element = array();
   $formatter_class = $display['type'];
   $is_loaded = tripal_load_include_field_class($formatter_class);
@@ -740,6 +745,12 @@ function tripal_field_settings_form_validate($element, &$form_state, $form) {
  * Implements hook_field_formatter_settings_summary().
  */
 function tripal_field_formatter_settings_summary($field, $instance, $view_mode) {
+
+  // TODO: (Shawna)  Add appropriate code here so that all TripalFields have
+  // the ability to change the bundle default about whether they are
+  // shown if they have no items.  We have to put this here rather than in the
+  // TripalFieldFormatter class because not all fields implement this class.
+
   $formatter_class = $field['type'] . '_formatter';
   if (tripal_load_include_field_class($formatter_class)) {
     $formatter = new $formatter_class($field, $instance);
@@ -753,11 +764,20 @@ function tripal_field_formatter_settings_summary($field, $instance, $view_mode)
 function tripal_field_formatter_settings_form($field, $instance,
     $view_mode, $form, &$form_state) {
 
+  // TODO: (Shawna)  Add form elements here so that all TripalFields have
+  // the ability to change the bundle default about whether they are
+  // shown if they have no items.  We have to put this here rather than in the
+  // TripalFieldFormatter class because not all fields implement this class.
+
   $formatter_class = $field['type'] . '_formatter';
+  $elements = array();
   if (tripal_load_include_field_class($formatter_class)) {
+
     $formatter = new $formatter_class($field, $instance);
-    return $formatter->settingsForm($view_mode, $form, $form_state);
+    $elements = $formatter->settingsForm($view_mode, $form, $form_state);
   }
+
+  return $elements;
 }