Browse Source

Themed relationship admin form option2

Chun-Huai Cheng 8 years ago
parent
commit
2a1acbcd0a

+ 27 - 2
tripal_chado/includes/TripalFields/chado_linker__relationship.inc

@@ -384,7 +384,6 @@ class chado_linker__relationship extends TripalField {
    * @see TripalField::validate()
    */
   function widgetFormValidate($entity_type, $entity, $langcode, $items, &$errors) {
-
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
     $field_table = $this->field['settings']['chado_table'];
@@ -874,6 +873,7 @@ class chado_linker__relationship extends TripalField {
           term for the relationship type.'),
       '#collapsed' => TRUE,
       '#collapsible' => TRUE,
+      '#theme' => 'chado_linker__relationship_instance_settings'
     );
 //     $element['instructions'] = array(
 //       '#type' => 'item',
@@ -881,7 +881,6 @@ class chado_linker__relationship extends TripalField {
 //         as the relationship types. This select box will replace the vocabulary select box if the
 //         following value is set.'
 //     );
-
     $vocs = tripal_get_cv_select_options();
     $element['relationships']['option1'] = array(
       '#type' => 'item',
@@ -1105,6 +1104,32 @@ function theme_chado_linker__relationship_widget($variables) {
   return $layout;
 }
 
+function theme_chado_linker__relationship_instance_settings ($variables) {
+  $element = $variables['element'];
+  $option1 = $element['option1'];
+  $option1_vocabs = $element['option1_vocabs'];
+  $option2 = $element['option2'];
+  $option2_vocab = $element['option2_vocab'];
+  $option2_parent = $element['option2_parent'];
+  $option3 = $element['option3'];
+  $rtype = $element['relationship_types'];
+  $layout = drupal_render($option1);
+  $layout .= drupal_render($option1_vocabs);
+  $layout .=
+    drupal_render($option2) .
+    "<div class=\"chado-linker--relationship-instance-settings-option2\">" .
+        "<div class=\"chado-linker--relationship-instance-settings-option2-item\">" .
+            drupal_render($option2_vocab) .
+        "</div>" .
+        "<div class=\"chado-linker--relationship-instance-settings-option2-item\">" .
+            drupal_render($option2_parent) .
+        "</div>" .
+    "</div>";
+  $layout .= drupal_render($option3);
+  $layout .= drupal_render($rtype);
+  return $layout;
+}
+
 /**
  * An Ajax callback for the relationshp widget.
  */

+ 8 - 1
tripal_chado/theme/css/tripal_chado.css

@@ -4,11 +4,18 @@
 .primary-dbxref-widget-item,
 .secondary-dbxref-widget-item,
 .kvproperty-adder-widget-item,
-.chado-linker--relationship-widget-item {
+.chado-linker--relationship-widget-item,
+.chado-linker--relationship-instance-settings-option2-item {
    float: left;
    margin-right: 10px;
 }
 
+.chado-linker--relationship-instance-settings-option2 {
+  float:left;
+  clear:both;
+  width:100%;
+}
+
 .primary-dbxref-widget-links,
 .secondary-dbxref-widget-links {
    clear: both;

+ 4 - 0
tripal_chado/tripal_chado.module

@@ -598,6 +598,10 @@ function tripal_chado_theme($existing, $type, $theme, $path) {
       'render element' => 'element',
       'file' => 'includes/TripalFields/chado_linker__relationship.inc',
     ),
+    'chado_linker__relationship_instance_settings' => array(
+      'render element' => 'element',
+      'file' => 'includes/TripalFields/chado_linker__relationship.inc',
+    ),
     'chado_linker__pub_widget' => array(
       'render element' => 'element',
       'file' => 'includes/TripalFields/chado_linker__pub.inc',