You are here

function node_recur_node_recur_confirm in Node recur 7

Same name and namespace in other branches
  1. 7.2 node_recur.pages.inc \node_recur_node_recur_confirm()

Confirm form for node recur

1 call to node_recur_node_recur_confirm()
node_recur_node_recur_form in ./node_recur.pages.inc
The node recur form

File

./node_recur.pages.inc, line 187

Code

function node_recur_node_recur_confirm($form, $form_state, $node) {
  $dates = node_recur_generate_dates_from_form($node, $form_state);

  // Make sure we have dates to work with
  if (empty($dates['start'])) {
    drupal_set_message(t('No dates were generated with the information you supplied.'), 'warning');
    drupal_goto("node/{$node->nid}/recur");
  }

  // Store the dates
  $form['#start_dates'] = $dates['start'];
  $form['#end_dates'] = $dates['end'];

  // Display the dates to the user
  $form['message'] = array(
    '#markup' => t('The following dates will be generated. Please review them before continuing.'),
  );
  $form['dates']['#markup'] = '<ul>';
  foreach ($dates['start'] as $key => $start_date) {
    $end_date = isset($dates['end'][$key]) ? $dates['end'][$key] : NULL;
    $form['dates']['#markup'] .= '<li>' . node_recur_format_date($start_date, $end_date) . '</li>';
  }
  $form['dates']['#markup'] .= '</ul>';

  // Store the node
  $form['#node'] = $node;

  // Add the submit handler
  $form['#submit'][] = 'node_recur_node_recur_confirm_submit';

  // Node type name
  $type = strtolower(node_type_get_name($node));

  // Supply the confirm form
  return confirm_form($form, t('Are you sure you want to generate these items?'), 'node/' . $node->nid, '<strong>' . t('This action cannot be undone. Please confirm that the dates above are accurate and that the %type information is correct. Editing this %type afterwards will not edit every %type generated here.', array(
    '%type' => $type,
    '%type' => $type,
    '%type' => $type,
  )) . '</strong>', t('Submit'));
}