function hosting_task_confirm_form in Hosting 6.2
Same name and namespace in other branches
- 5 task/hosting_task.module \hosting_task_confirm_form()
- 7.4 task/hosting_task.module \hosting_task_confirm_form()
- 7.3 task/hosting_task.module \hosting_task_confirm_form()
Implementation of hook_form().
1 string reference to 'hosting_task_confirm_form'
- hosting_task_menu in task/
hosting_task.module - Implementation of hook_menu().
File
- task/
hosting_task.module, line 413 - Web server node type is defined here.
Code
function hosting_task_confirm_form($form_state, $node, $task) {
drupal_add_js(drupal_get_path('module', 'hosting_task') . '/hosting_task.js');
$tasks = hosting_available_tasks($node->type);
if (!isset($tasks[$task]['dialog']) || !$tasks[$task]['dialog']) {
hosting_add_task($node->nid, $task);
drupal_goto('node/' . $node->nid);
}
$form['help'] = array(
'#value' => $tasks[$task]['description'],
);
$form['nid'] = array(
'#type' => 'value',
'#value' => $node->nid,
);
$form['task'] = array(
'#type' => 'value',
'#value' => $task,
);
$form['parameters'] = array(
'#tree' => TRUE,
);
$func = 'hosting_task_' . str_replace('-', '_', $task) . '_form';
if (function_exists($func)) {
$form['parameters'] += $func($node);
}
$func = $func . '_validate';
if (function_exists($func)) {
$form['#validate'][] = $func;
$form['#func_param_1'] = $node;
$form['#func_param_2'] = $task;
}
$question = t("Are you sure you want to @task @object?", array(
'@task' => $task,
'@object' => $node->title,
));
$path = !empty($_REQUEST['destination']) ? $_REQUEST['destination'] : 'node/' . $node->nid;
$form = confirm_form($form, $question, $path, '', $tasks[$task]['title']);
// add an extra class to the actions to allow us to disable the cancel link via javascript for the modal dialog
$form['actions']['#prefix'] = '<div id="hosting-task-confirm-form-actions" class="container-inline">';
return $form;
}