You are here

function formdefaults_import in Form Defaults 6.2

Same name and namespace in other branches
  1. 5.3 formdefaults.admin.inc \formdefaults_import()
  2. 7 formdefaults.admin.inc \formdefaults_import()
1 string reference to 'formdefaults_import'
formdefaults_menu in ./formdefaults.module
Implements hook_menu.

File

./formdefaults.admin.inc, line 146

Code

function formdefaults_import() {
  $form_list = formdefaults_data();
  if ($form_list) {
    $data = base64_encode(serialize($form_list));
  }
  $form['data'] = array(
    '#type' => 'textarea',
    '#title' => 'Data',
    '#default_value' => $data,
    '#rows' => 20,
    '#cols' => 80,
  );
  $form['list'] = array(
    '#type' => 'fieldset',
    '#title' => 'Forms',
  );
  if ($form_list) {
    foreach ($form_list as $key => $formdata) {
      $form['list'][] = array(
        '#type' => 'markup',
        '#value' => "<p>{$key}</p>",
      );
    }
  }
  $form['validate'] = array(
    '#type' => 'submit',
    '#value' => 'Preview',
  );
  if ($data) {
    $form['import'] = array(
      '#type' => 'submit',
      '#value' => 'Import',
    );
  }
  return $form;
}