You are here

function regcode_form_add_codetemplate in Registration codes 5.3

Add the fieldset for code template to a given form

Parameters

form: The reference to the form to add the code-template-fieldset to

2 calls to regcode_form_add_codetemplate()
regcode_admin_import in ./regcode_admin.inc.php
Return the form associated with the registration code import admin page
regcode_admin_settings in ./regcode_admin.inc.php
Return the form associated with the module settings.

File

./regcode_admin.inc.php, line 344
regcode_admin.inc.php contains the top-level logic for the administration pages for the registration-code module

Code

function regcode_form_add_codetemplate(&$form) {
  $form['regcode_template'] = array(
    '#type' => 'fieldset',
    '#title' => t('Code template'),
    '#description' => t('Default field data to use as template for every imported code, if not given in import data.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $fields = regcode_get_fields(FALSE, TRUE);
  unset($fields['c.code']);
  foreach ($fields as $field_name => $field_title) {
    $field_name = str_replace('c.', '', $field_name);
    $form['regcode_template']['regcode_template_' . $field_name] = array(
      '#type' => 'textfield',
      '#title' => $field_title,
      '#default_value' => variable_get('regcode_template_' . $field_name, ''),
    );
  }
  $form['regcode_template']['regcode_template_rid']['#type'] = 'select';
  $form['regcode_template']['regcode_template_rid']['#options'] = user_roles();
  $form['regcode_template']['regcode_template_rid']['#options'][''] = '-';
}