function _privatemsg_action_form in Privatemsg 7.2
Same name and namespace in other branches
- 6.2 privatemsg.pages.inc \_privatemsg_action_form()
- 6 privatemsg.module \_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 22 - 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'],
'#ajax' => array(
'callback' => 'privatemsg_list_js',
'wrapper' => 'privatemsg-list-form',
'effect' => 'fade',
),
);
}
elseif (isset($array['label'])) {
$options[$operation] = $array['label'];
}
}
if (!empty($options)) {
array_unshift($options, t('Actions...'));
$form['operation'] = array(
'#type' => 'select',
'#options' => $options,
'#ajax' => array(
'callback' => 'privatemsg_list_js',
'wrapper' => 'privatemsg-list-form',
'effect' => 'fade',
),
'#executes_submit_callback' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Execute'),
'#attributes' => array(
'class' => array(
'form-item',
),
),
'#states' => array(
'visible' => array(
// This is never true, button is always hidden when JS is enabled.
':input[name=operation]' => array(
'value' => 'fake',
),
),
),
);
}
return $form;
}