You are here

function lingotek_edit_defaults_form in Lingotek Translation 7.7

Edit defaults - Form Layout

1 string reference to 'lingotek_edit_defaults_form'
lingotek_menu in ./lingotek.module
Implements hook_menu().

File

./lingotek.setup.inc, line 411

Code

function lingotek_edit_defaults_form() {
  $form = array();
  $api = LingotekApi::instance();
  $project_defaults = variable_get('lingotek_project_defaults', array());
  asort($project_defaults);
  $workflow_defaults = variable_get('lingotek_workflow_defaults', array());
  asort($workflow_defaults);
  $vault_defaults = variable_get('lingotek_vaults_defaults', array());
  $default_workflow_id = variable_get('lingotek_workflow', NULL);
  $curr_workflow = $api
    ->getWorkflow($default_workflow_id);
  if (!empty($curr_workflow)) {
    $workflow_defaults = array(
      $default_workflow_id => $curr_workflow->name,
    ) + $workflow_defaults;
  }
  $form['lingotek_project'] = array(
    '#type' => 'select',
    '#title' => t('Default Project'),
    '#options' => $project_defaults,
    '#default_value' => variable_get('lingotek_project', NULL),
    '#required' => TRUE,
  );
  $form['lingotek_workflow'] = array(
    '#type' => 'select',
    '#title' => t('Default Workflow'),
    '#options' => $workflow_defaults,
    '#default_value' => $default_workflow_id,
    '#required' => TRUE,
  );
  $form['lingotek_vault'] = array(
    '#type' => 'select',
    '#title' => t('Default Vault'),
    '#options' => $vault_defaults,
    '#default_value' => variable_get('lingotek_vault', NULL),
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}