From af2675bab69aa5d7331c731299f0d95efabf9635 Mon Sep 17 00:00:00 2001
From: Sascha Grossenbacher <saschagros@gmail.com>
Date: Fri, 1 Apr 2011 23:50:20 +0200
Subject: [PATCH] Issue #1099398 by Berdir: Added states integration to hide dependant form fields in add relationship type.

---
 user_relationships.admin.inc |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/user_relationships.admin.inc b/user_relationships.admin.inc
index eea3682..298f83b 100644
--- a/user_relationships.admin.inc
+++ b/user_relationships.admin.inc
@@ -209,6 +209,11 @@ function user_relationships_admin_type_edit($form, &$form_state, $relationship_t
     '#default_value'  => isset($relationship_type->expires_val) ? $relationship_type->expires_val : 0,
     '#description'    => t('After how many days should a request of this type be removed? (0 for never)'),
     '#weight'         => -7,
+    '#states'         => array(
+      'visible'         => array(
+        ':input[name=requires_approval]' => array('checked' => TRUE),
+      ),
+    ),
   );
   $form['general']['is_oneway'] = array(
     '#type'           => 'checkbox',
@@ -223,6 +228,11 @@ function user_relationships_admin_type_edit($form, &$form_state, $relationship_t
     '#default_value'  => isset($relationship_type) ? $relationship_type->is_reciprocal : NULL,
     '#description'    => t('Check if this one-way relationship can go either way'),
     '#weight'         => -5,
+    '#states'         => array(
+      'visible'         => array(
+        ':input[name=is_oneway]' => array('checked' => TRUE),
+      ),
+    ),
   );
 
   $form['roles'] = array(
-- 
1.7.4.1

