function flatcomments_existing_form in Flatcomments 6
Same name and namespace in other branches
- 6.2 flatcomments_existing/flatcomments_existing.admin.inc \flatcomments_existing_form()
This is a multi-pass form, the confirmation being second pass.
1 string reference to 'flatcomments_existing_form'
- flatcomments_existing_menu in flatcomments_existing/
flatcomments_existing.module - Implementation of hook_menu().
File
- flatcomments_existing/
flatcomments_existing.admin.inc, line 12 - Administrative callbacks to provide the functionality of flattening previously existing comments.
Code
function flatcomments_existing_form($form_state) {
if (empty($form_state['storage']['types'])) {
// First pass: Fresh form to select content types
$form['types'] = array(
'#type' => 'checkboxes',
'#title' => t('Flatten existing comments for content types'),
'#options' => node_get_types('names'),
'#description' => t('To remove all threading information from already existing comments, select content types you wish to process, and click "Execute". <strong>Warning: This operation breaks any previously existing threads into separate comments permanently, so there\'s no way to revert existing discussions back to threads afterwards.</strong>'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Execute'),
);
$form['#submit'] = array(
'flatcomments_existing_form_submit_1',
);
}
else {
// Second pass: Confirmation screen
$form['types'] = array(
'#type' => 'value',
'#value' => $form_state['storage']['types'],
);
$form['#submit'] = array(
'flatcomments_existing_form_submit_2',
);
$form = confirm_form($form, t('Are you sure you want to remove threading from these comments?'), 'admin/content/comment/flatten', t('<strong>Warning: This operation is permanent and can NOT be undone. All comments of the selected content types will be flattened.</strong>'), t('Flatten comments'), t('Cancel'));
}
return $form;
}