You are here

function hosting_task_retry_form in Hosting 7.4

Same name and namespace in other branches
  1. 5 task/hosting_task.module \hosting_task_retry_form()
  2. 6.2 task/hosting_task.module \hosting_task_retry_form()
  3. 7.3 task/hosting_task.module \hosting_task_retry_form()

Adds a retry button to failed task nodes.

1 string reference to 'hosting_task_retry_form'
hosting_task_view in task/hosting_task.module
Implements hook_view().

File

task/hosting_task.module, line 1106
Web server node type is defined here.

Code

function hosting_task_retry_form($form, $form_state, $nid) {
  $form['#prefix'] = '<div class="hosting-task-retry">';
  $form['task'] = array(
    '#type' => 'hidden',
    '#default_value' => $nid,
  );

  // Decide on button label.
  $task = node_load($nid);
  $button = t('Retry');
  if ($task->task_type == 'install' && $task->task_status != HOSTING_TASK_ERROR) {
    $button = t('Reinstall');
  }
  elseif ($task->task_status == HOSTING_TASK_SUCCESS || $task->task_status == HOSTING_TASK_WARNING) {
    $button = t('Run Again');
  }
  $form['retry'] = array(
    '#type' => 'submit',
    '#value' => $button,
  );
  $form['#suffix'] = '</div>';
  return $form;
}