function hosting_task_confirm_form in Hostmaster (Aegir) 6
Implementation of hook_form().
1 string reference to 'hosting_task_confirm_form'
- hosting_task_menu in modules/
hosting/ task/ hosting_task.module - Implementation of hook_menu().
File
- modules/
hosting/ task/ hosting_task.module, line 383 - 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,
));
$form = confirm_form($form, $question, 'node/' . $node->nid, '', $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;
}