You are here

function sheetnode_import_template in Sheetnode 7

Same name and namespace in other branches
  1. 5 sheetnode.module \sheetnode_import_template()
  2. 6 sheetnode.module \sheetnode_import_template()
  3. 7.2 sheetnode.module \sheetnode_import_template()

Form function for node/add/sheetnode_template.

1 string reference to 'sheetnode_import_template'
sheetnode_menu in ./sheetnode.module
Implements hook_menu().

File

./sheetnode.module, line 523
Module file for the sheetnode module.

Code

function sheetnode_import_template($form, &$form_state, $tid = NULL) {
  if (!empty($tid)) {
    $form_state['values']['template'] = $tid;
    sheetnode_import_template_submit($form, $form_state);
    drupal_goto($form_state['redirect']);
  }
  $options[0] = t('- Select a template -');
  $templates = db_query("SELECT tid, name FROM {sheetnode_template}");
  foreach ($templates as $template) {
    $options[$template->tid] = $template->name;
  }
  $form['template'] = array(
    '#type' => 'select',
    '#title' => t('Template'),
    '#description' => t('Please select the template to load into your new sheetnode.'),
    '#options' => $options,
    '#default_value' => 0,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}