You are here

function key_input_generate_build_configuration_form in Key 7.3

Build the plugin configuration form.

Return value

array The plugin configuration form.

1 string reference to 'key_input_generate_build_configuration_form'
generate.inc in plugins/key_input/generate.inc

File

plugins/key_input/generate.inc, line 36

Code

function key_input_generate_build_configuration_form($form, &$form_state) {
  $key_value_data = $form_state['storage']['key_value'];
  $config = $form_state['storage']['key_config'];
  $plugin_config = $config['key_input_settings'] + key_input_generate_default_configuration();

  // If the key value has already been generated.
  if ($plugin_config['generated']) {
    $form['key_value_message'] = array(
      '#markup' => t('The key value has already been generated and will not be changed.'),
    );
    $form['display_once'] = array(
      '#type' => 'value',
      '#value' => $plugin_config['display_once'],
    );
  }
  else {
    $form['key_value_message'] = array(
      '#markup' => t('The key value will be automatically generated using the selected key type settings.'),
    );

    // Allow the user to choose to display the key value once.
    $form['display_once'] = array(
      '#type' => 'checkbox',
      '#title' => t('Display value'),
      '#description' => t('Check this to display the generated value once.'),
      '#default_value' => $plugin_config['display_once'],
    );
  }
  $form['generated'] = array(
    '#type' => 'value',
    '#value' => $plugin_config['generated'],
  );
  return $form;
}