#196671 by sun: Make switch_user list an API call that can be shared.
authorDerek Wright
Thu, 13 Dec 2007 08:21:42 +0000 (08:21 +0000)
committerDerek Wright
Thu, 13 Dec 2007 08:21:42 +0000 (08:21 +0000)
devel.module

index 06c1b03..1ddb16e 100644 (file)
@@ -424,6 +424,15 @@ function devel_block_devel() {
 
 function devel_block_switch_user() {
   $block['subject'] = t('Switch user');
+  $links = devel_switch_user_list();
+  if (!empty($links)) {
+    $block['content'] = theme('item_list', $links);
+    $block['content'] .= drupal_get_form('devel_switch_user_form');
+    return $block;
+  }
+}
+
+function devel_switch_user_list() {
   $links = array();
   if (user_access('switch users')) {
     $dest = drupal_get_destination();
@@ -455,11 +464,7 @@ function devel_block_switch_user() {
       }
     }
   }
-  if (!empty($links)) {
-    $block['content'] = theme('item_list', $links);
-    $block['content'] .= drupal_get_form('devel_switch_user_form');
-    return $block;
-  }
+  return $links;
 }
 
 function devel_phpinfo() {