You are here

function devel_block_switch_user in Devel 7

Same name and namespace in other branches
  1. 6 devel.module \devel_block_switch_user()

Provides the Switch user block.

Return value

array A render array containing the Switch user block.

1 call to devel_block_switch_user()
devel_block_view in ./devel.module
Implements hook_block_view().

File

./devel.module, line 883
This module holds functions useful for Drupal development.

Code

function devel_block_switch_user() {
  $links = devel_switch_user_list();
  if (!empty($links) || user_access('switch users')) {
    drupal_add_css(drupal_get_path('module', 'devel') . '/devel.css');
    $block['subject'] = t('Switch user');
    $build['devel_links'] = array(
      '#theme' => 'links',
      '#links' => $links,
    );
    if (variable_get('devel_switch_user_show_form', TRUE)) {
      $build['devel_form'] = drupal_get_form('devel_switch_user_form');
    }
    $block['content'] = $build;
    return $block;
  }
}