Browse Source

Fixed publication field widget

Stephen Ficklin 8 years ago
parent
commit
a9a766d332

+ 2 - 2
tripal_chado/includes/TripalFields/schema__publication/schema__publication_widget.inc

@@ -13,7 +13,7 @@ class schema__publication_widget extends ChadoFieldWidget {
    */
   public function form(&$widget, &$form, &$form_state, $langcode, $items, $delta, $element) {
     parent::form($widget, $form, $form_state, $langcode, $items, $delta, $element);
-    $entity = $form['#entity'];
+
     $field_name = $this->field['field_name'];
 
     // Get the FK column that links to the base table.
@@ -26,7 +26,7 @@ class schema__publication_widget extends ChadoFieldWidget {
 
     // Get the field defaults.
     $record_id = '';
-    $fkey_value = $element['#entity']->chado_record_id;
+    $fkey_value = array_key_exists('#entity', $element) and $element['#entity'] ? $element['#entity']->chado_record_id : NULL;
     $pub_id = '';
     $uname = '';