function devel_block in Devel 6
Same name and namespace in other branches
- 5 devel.module \devel_block()
Implementation of hook_block().
File
- ./
devel.module, line 618
Code
function devel_block($op = 'list', $delta = 0, $edit = array()) {
if ($op == 'list') {
$blocks[0]['info'] = t('Switch user');
// $blocks[1]['info'] = t('Devel');
$blocks[2] = array(
'info' => t('Execute PHP'),
'visibility' => 0,
'pages' => 'devel/php',
);
return $blocks;
}
elseif ($op == 'configure' && $delta == 0) {
$form['list_size'] = array(
'#type' => 'textfield',
'#title' => t('Number of users to display in the list'),
'#default_value' => variable_get('devel_switch_user_list_size', 10),
'#size' => '3',
'#maxlength' => '4',
);
$form['show_form'] = array(
'#type' => 'checkbox',
'#title' => t('Allow entering any user name'),
'#default_value' => variable_get('devel_switch_user_show_form', TRUE),
);
return $form;
}
elseif ($op == 'save' && $delta == 0) {
variable_set('devel_switch_user_list_size', $edit['list_size']);
variable_set('devel_switch_user_show_form', $edit['show_form']);
}
elseif ($op == 'view') {
$block = array();
switch ($delta) {
case 0:
$block = devel_block_switch_user();
break;
case 1:
// Deleted in favor of custom menu. do not reuse this index.
break;
case 2:
if (user_access('execute php code')) {
$block['content'] = drupal_get_form('devel_execute_block_form');
}
break;
}
return $block;
}
}