function _privatemsg_action_form in Privatemsg 6.2
Same name and namespace in other branches
- 6 privatemsg.module \_privatemsg_action_form()
- 7.2 privatemsg.pages.inc \_privatemsg_action_form()
- 7 privatemsg.pages.inc \_privatemsg_action_form()
Returns a form which handles and displays thread actions.
Additional actions can be added with the privatemsg_thread_operations hook. It is also possible to extend this form with additional buttons or other elements, in that case, the definitions in the above hook need no label tag, instead, the submit button key needs to match with the key of the operation.
Return value
The FAPI definitions for the thread action form.
See also
hook_privatemsg_thread_operations()
1 call to _privatemsg_action_form()
File
- ./
privatemsg.pages.inc, line 651 - User menu callbacks for Privatemsg.
Code
function _privatemsg_action_form($type) {
$form = array(
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
'#weight' => -5,
);
// Display all operations which have a label.
$operations = module_invoke_all('privatemsg_thread_operations', $type);
drupal_alter('privatemsg_thread_operations', $operations, $type);
foreach ($operations as $operation => $array) {
if (!empty($array['button'])) {
$form[$operation] = array(
'#type' => 'submit',
'#value' => $array['label'],
);
}
elseif (isset($array['label'])) {
$options[$operation] = $array['label'];
}
}
if (!empty($options)) {
array_unshift($options, t('Actions...'));
$form['operation'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => 0,
);
$form['submit'] = array(
'#prefix' => '<div class="privatemsg-op-button">',
'#suffix' => '</div>',
'#type' => 'submit',
'#value' => t('Execute'),
'#submit' => array(
'privatemsg_list_submit',
),
'#attributes' => array(
'class' => 'privatemsg-action-button',
),
);
}
// JS for hiding the execute button.
drupal_add_js(drupal_get_path('module', 'privatemsg') . '/privatemsg-list.js');
return $form;
}