You are here

function gathercontent_import_form_confirm in GatherContent 7.3

Smg.

@inheritdoc

1 string reference to 'gathercontent_import_form_confirm'
gathercontent_import_form in ./gathercontent.import.inc
Multistep form function.

File

./gathercontent.import.inc, line 457

Code

function gathercontent_import_form_confirm($form, &$form_state) {
  $form['title'] = array(
    'form_title' => array(
      '#type' => 'html_tag',
      '#tag' => 'h2',
      '#value' => format_plural(count($form_state['object']->nodes), 'Confirm import selection (@count item)', 'Confirm import selection (@count items)'),
    ),
    'form_description' => array(
      '#type' => 'html_tag',
      '#tag' => 'p',
      '#value' => t('Please review your import selection before importing.'),
    ),
  );
  $header = array(
    'status' => t('Status'),
    'title' => t('Item name'),
    'template' => t('GatherContent Template'),
  );
  $options = array();
  $tmp_obj = new Template();
  $templates = $tmp_obj
    ->getTemplates($form_state['object']->project_id);
  foreach ($form_state['object']->nodes as $node) {
    $content_obj = new Content();
    $content = $content_obj
      ->getContent($node);
    $options[$content->id] = array(
      'status' => '<div style="width:20px; height: 20px; float: left; margin-right: 5px; background: ' . $content->status->data->color . ';"></div>' . $content->status->data->name,
      'title' => $content->name,
      'template' => $templates[$content->template_id],
    );
  }
  $table = theme('table', array(
    'header' => $header,
    'rows' => $options,
  ));
  $form['table'] = array(
    '#markup' => render($table),
  );
  $options = array();
  $project_obj = new Project();
  $statuses = $project_obj
    ->getStatuses($form_state['object']->project_id);
  foreach ($statuses as $status) {
    $options[$status->id] = $status->name;
  }
  $form['node_update_method'] = [
    '#type' => 'radios',
    '#required' => TRUE,
    '#title' => t('Content update method'),
    '#default_value' => variable_get('gathercontent_node_update_method', 'always_update'),
    '#options' => [
      'always_create' => t('Always create new Content'),
      'update_if_not_changed' => t('Create new Content if it has changed since the last import'),
      'always_update' => t('Always update existing Content'),
    ],
  ];
  $form['status'] = array(
    '#type' => 'select',
    '#options' => $options,
    '#title' => t('After successful import change status to:'),
    '#empty_option' => t("- Don't change status -"),
  );
  return $form;
}