浏览代码

Fixed bug with entity form submit

Stephen Ficklin 8 年之前
父节点
当前提交
eb2f68c63b

+ 3 - 0
tripal/includes/TripalField.inc

@@ -67,6 +67,9 @@ class TripalField {
     $this->field_type = get_class($this);
 
     // Determine if this field can attach to the bundle.
+    if ($this->field_type == "chado_base__dbxref_id") {
+      dpm(debug_backtrace());
+    }
     $this->setCanAttach();
 
     // Set the field's name.

+ 1 - 1
tripal_chado/includes/fields/chado_base__dbxref_id.inc

@@ -20,7 +20,7 @@ class chado_base__dbxref_id extends TripalField {
     );
   }
   /**
-   * @see TripalField::can_attach()
+   * @see TripalField::setCanAttach()
    */
   protected function setCanAttach() {
 

+ 4 - 6
tripal_chado/includes/tripal_chado.fields.inc

@@ -685,14 +685,13 @@ function tripal_chado_field_validate($entity_type, $entity, $field, $instance,
   module_load_include('inc', 'tripal_chado', 'includes/fields/' . $field_type);
   if (class_exists($field_type)) {
     $bundle = isset($entity->bundle) ? $entity->bundle : NULL;
-    $field_obj = new $field_type($entity_type, $bundle);
-    $form = $field_obj::widgetFormValidate($entity_type, $entity, $field, $instance,
+    $form = $field_type::widgetFormValidate($entity_type, $entity, $field, $instance,
         $langcode, $items, $errors);
   }
 }
 
 /**
- * Implements hook_field_validate()
+ * Implements hook_field_submit()
  *
  * This is a TripalEntity specific hook.
  */
@@ -702,9 +701,8 @@ function tripal_chado_field_submit($entity_type, $entity, $field, $instance,
   $field_type = $field['type'];
   module_load_include('inc', 'tripal_chado', 'includes/fields/' . $field_type);
   if (class_exists($field_type)) {
-    $field_obj = new $field_type($entity_type, $entity->bundle);
-    $form = $field_obj::widgetFormSubmit($entity_type, $entity, $field, $instance,
-        $langcode, $items, $errors);
+    $form = $field_type::widgetFormSubmit($entity_type, $entity, $field, $instance,
+        $langcode, $items, $form, $form_state);
   }
 }
 

+ 11 - 0
tripal_chado/includes/tripal_chado.publish.inc

@@ -60,10 +60,21 @@ function tripal_chado_publish_form($form, &$form_state) {
   return $form;
 }
 
+/**
+ *
+ * @param unknown $form
+ * @param unknown $form_state
+ */
 function tripal_chado_publish_form_validate($form, &$form_state) {
 
 }
 
+/**
+ *
+ * @param unknown $form
+ * @param unknown $form_state
+ * @return The
+ */
 function tripal_chado_publish_form_submit($form, &$form_state) {
   if ($form_state['clicked_button']['#name'] == 'publish_btn') {
     global $user;