|  | @@ -293,7 +293,7 @@ class chado_linker__relationship extends TripalField {
 | 
	
		
			
				|  |  |        $subject_id = $item[$field_table . '__subject_id'];
 | 
	
		
			
				|  |  |        $object_id = $item[ $field_table . '__object_id'];
 | 
	
		
			
				|  |  |        $type_id = $item[$field_table . '__type_id'];
 | 
	
		
			
				|  |  | -      $type_name = $item['type_name'];
 | 
	
		
			
				|  |  | +      $type_name = isset($item['type_name']) ? $item['type_name'] : '';
 | 
	
		
			
				|  |  |        $subject_name = $item['subject_name'];
 | 
	
		
			
				|  |  |        $object_name = $item['object_name'];
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -841,37 +841,41 @@ class chado_linker__relationship extends TripalField {
 | 
	
		
			
				|  |  |     */
 | 
	
		
			
				|  |  |    public function instanceSettingsFormValidate($form, &$form_state) {
 | 
	
		
			
				|  |  |      //dpm($form);dpm($form_state);
 | 
	
		
			
				|  |  | -//     $settings = $form_state['values']['instance']['settings'];
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -//     // Make sure the supplied types are valid cvterms
 | 
	
		
			
				|  |  | -//     if (isset($settings['relationship_types'])) {
 | 
	
		
			
				|  |  | -//       $rel_types = explode(PHP_EOL, $settings['relationship_types']);
 | 
	
		
			
				|  |  | -//       foreach($rel_types AS $type) {
 | 
	
		
			
				|  |  | -//         // Ignore empty lines
 | 
	
		
			
				|  |  | -//         if (trim($type) == '') {
 | 
	
		
			
				|  |  | -//           continue;
 | 
	
		
			
				|  |  | -//         }
 | 
	
		
			
				|  |  | -//         $term = tripal_get_cvterm(array('name' => trim($type)));
 | 
	
		
			
				|  |  | -//         // Don't save the form  if a term can not be found or it matches more than one cvterm
 | 
	
		
			
				|  |  | -//         if (!isset($term->cvterm_id)) {
 | 
	
		
			
				|  |  | -//           form_set_error(
 | 
	
		
			
				|  |  | -//             "instance][settings][relationships][relationship_types",
 | 
	
		
			
				|  |  | -//             t("The term '@type' can not be found or matches more than one term.", array('@type' => $type))
 | 
	
		
			
				|  |  | -//           );
 | 
	
		
			
				|  |  | -//         }
 | 
	
		
			
				|  |  | -//       }
 | 
	
		
			
				|  |  | -//     }
 | 
	
		
			
				|  |  | -//     // Make sure child relationship types are using a valid cvterm
 | 
	
		
			
				|  |  | -//     if (isset($settings['child_relationship_types'])) {
 | 
	
		
			
				|  |  | -//       $supertype = $settings['child_relationship_types'];
 | 
	
		
			
				|  |  | -//       $term = tripal_get_cvterm(array('name' => trim($supertype)));
 | 
	
		
			
				|  |  | -//       if (!isset($term->cvterm_id)) {
 | 
	
		
			
				|  |  | -//         form_set_error(
 | 
	
		
			
				|  |  | -//           "instance][settings][relationships][child_relationship_types",
 | 
	
		
			
				|  |  | -//           t("The term '@type' can not be found or matches more than one term.", array('@type' => $supertype))
 | 
	
		
			
				|  |  | -//         );
 | 
	
		
			
				|  |  | -//       }
 | 
	
		
			
				|  |  | -//     }
 | 
	
		
			
				|  |  | +     $settings = $form_state['values']['instance']['settings']['relationships'];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +     // Make sure the supplied types are valid cvterms
 | 
	
		
			
				|  |  | +     if (isset($settings['relationship_types'])) {
 | 
	
		
			
				|  |  | +       $rel_types = explode(PHP_EOL, $settings['relationship_types']);
 | 
	
		
			
				|  |  | +       foreach($rel_types AS $type) {
 | 
	
		
			
				|  |  | +         // Ignore empty lines
 | 
	
		
			
				|  |  | +         if (trim($type) == '') {
 | 
	
		
			
				|  |  | +           continue;
 | 
	
		
			
				|  |  | +         }
 | 
	
		
			
				|  |  | +         $term = tripal_get_cvterm(array('name' => trim($type)));
 | 
	
		
			
				|  |  | +         // Don't save the form  if a term can not be found or it matches more than one cvterm
 | 
	
		
			
				|  |  | +         if (!isset($term->cvterm_id)) {
 | 
	
		
			
				|  |  | +           form_set_error(
 | 
	
		
			
				|  |  | +             "instance][settings][relationships][relationship_types",
 | 
	
		
			
				|  |  | +             t("The term '@type' can not be found or matches more than one term.", array('@type' => $type))
 | 
	
		
			
				|  |  | +           );
 | 
	
		
			
				|  |  | +         }
 | 
	
		
			
				|  |  | +       }
 | 
	
		
			
				|  |  | +     }
 | 
	
		
			
				|  |  | +     // Make sure child relationship types are using a valid cvterm
 | 
	
		
			
				|  |  | +     if (isset($settings['option2_parent']) && $settings['option2_parent']) {
 | 
	
		
			
				|  |  | +       $cv_id = $settings['option2_vocab'];
 | 
	
		
			
				|  |  | +       $supertype = $settings['option2_parent'];
 | 
	
		
			
				|  |  | +       $term = tripal_get_cvterm(array(
 | 
	
		
			
				|  |  | +         'name' => trim($supertype),
 | 
	
		
			
				|  |  | +         'cv_id' => $cv_id
 | 
	
		
			
				|  |  | +       ));
 | 
	
		
			
				|  |  | +       if (!isset($term->cvterm_id)) {
 | 
	
		
			
				|  |  | +         form_set_error(
 | 
	
		
			
				|  |  | +           "instance][settings][relationships][option2_parent",
 | 
	
		
			
				|  |  | +           t("The term '@type' is not a valid term for the vocabulary selected.", array('@type' => $supertype))
 | 
	
		
			
				|  |  | +         );
 | 
	
		
			
				|  |  | +       }
 | 
	
		
			
				|  |  | +     }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 |