function workflow_state_delete_form in Workflow 5.2
Same name and namespace in other branches
- 5 workflow.module \workflow_state_delete_form()
Create the form for confirmation of deleting a workflow state.
Parameters
$wid: integer The ID of the workflow.
$sid: The ID of the workflow state.
Return value
HTML form.
1 call to workflow_state_delete_form()
- workflow_delete_form in ./
workflow.module - Create the form for confirmation of deleting a workflow.
1 string reference to 'workflow_state_delete_form'
- workflow_menu in ./
workflow.module - Implementation of hook_menu().
File
- ./
workflow.module, line 1474
Code
function workflow_state_delete_form($wid, $sid) {
$states = workflow_get_states($wid);
$state_name = $states[$sid];
// Will any nodes have no state if this state is deleted?
if ($count = db_result(db_query("SELECT COUNT(nid) FROM {workflow_node} WHERE sid = %d", $sid))) {
// Cannot assign a node to (creation) because that implies
// that the node does not exist.
$key = array_search(t('(creation)'), $states);
unset($states[$key]);
// Don't include the state to be deleted in our list of possible
// states that can be assigned.
unset($states[$sid]);
$form['new_sid'] = array(
'#type' => 'select',
'#title' => t('State to be assigned to orphaned nodes'),
'#description' => format_plural($count, 'Since you are deleting a workflow state, @count node which is in that state will be orphaned, and must be reassigned to a new state. Please choose the new state.', 'Since you are deleting a workflow state, @count nodes which are in that state will be orphaned, and must be reassigned to a new state. Please choose the new state.'),
'#options' => $states,
);
}
$form['wid'] = array(
'#type' => 'value',
'#value' => $wid,
);
$form['sid'] = array(
'#type' => 'value',
'#value' => $sid,
);
return confirm_form($form, t('Are you sure you want to delete %title (and all its transitions)?', array(
'%title' => $state_name,
)), $_GET['destination'] ? $_GET['destination'] : 'admin/build/workflow', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}