function privatemsg_new_folder_form in Privatemsg 5
Same name and namespace in other branches
- 5.3 privatemsg.module \privatemsg_new_folder_form()
Form to add a new folder.
2 string references to 'privatemsg_new_folder_form'
- privatemsg_manage_folders in ./
privatemsg.module - Display the console that lets users manage their private message folders.
- privatemsg_menu in ./
privatemsg.module - Implementation of hook_menu().
File
- ./
privatemsg.module, line 1170
Code
function privatemsg_new_folder_form() {
if (arg(2) == 'movetonew') {
$movetonew = TRUE;
}
else {
$movetonew = FALSE;
}
if (isset($_SESSION['privatemsg'])) {
$name_desc = t('Enter a name for the new folder.');
$form['messages'] = array(
'#tree' => TRUE,
);
foreach ($_SESSION['privatemsg'] as $mid => $message) {
if ($message['selected']) {
$form['messages'][$mid] = array(
'#type' => 'hidden',
'#value' => $mid,
);
}
}
}
else {
if ($movetonew) {
drupal_goto('privatemsg/folders');
}
}
$to_fid = $_SESSION['fromfolder'];
if (empty($to_fid)) {
$path = 'privatemsg';
}
elseif (substr($to_fid, 0, 4) == 'view') {
$path = 'privatemsg/' . $to_fid;
}
elseif (is_numeric($to_fid)) {
$path = 'privatemsg/list/' . $to_fid;
}
else {
$path = 'privatemsg';
}
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('New folder'),
'#description' => isset($name_desc) ? $name_desc : '',
'#size' => 24,
'#maxlength' => 64,
'#prefix' => $movetonew ? '' : '<fieldset><div class="container-inline">',
);
$form['op'] = array(
'#type' => 'submit',
'#value' => $movetonew ? t('Create folder') : t('Add'),
'#suffix' => $movetonew ? l(t('Cancel'), $path) : '</div></fieldset>',
);
$form['#access'] = user_access('create new folder');
return $form;
}