You are here

function certificate_sets_form in Certificate 6

Form for certificate type.

1 string reference to 'certificate_sets_form'
certificate_menu in ./certificate.module
Implementation of hook_menu().

File

./certificate.admin.inc, line 249
Administrative pages for the module.

Code

function certificate_sets_form(&$form_state, $type = array()) {
  $form = array();
  if (count($type)) {
    drupal_set_title('Edit criteria set');
  }
  else {
    drupal_set_title('Create criteria set');
  }

  // Get existing templates.
  $templates = certificate_certificate_load_all();
  $template_options = array();
  foreach ($templates as $key => $template) {
    $template_options[$key] = $template['title'];
  }
  module_load_include('inc', 'hs_field_selector');
  $form['type_id'] = array(
    '#type' => 'hidden',
    '#default_value' => $type->type_id,
  );
  $form['name'] = array(
    '#title' => 'Name',
    '#type' => 'textfield',
    '#size' => 20,
    '#prefix' => '<td>',
    '#suffix' => '</td>',
    '#default_value' => $type->name,
    '#description' => t('A name that will not be displayed to users'),
  );
  $form['template_id'] = array(
    '#type' => 'select',
    '#title' => 'Template',
    '#options' => $template_options,
    '#prefix' => '<td>',
    '#suffix' => '</td>',
    '#default_value' => $type->template_id,
    '#description' => t('Choose the certificate that will be rendered for this criteria.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#title' => 'Save',
    '#value' => 'Save',
  );
  return $form;
}