You are here

function lingotek_admin_field_settings_form in Lingotek Translation 7.7

Field Types and Settings Form

1 string reference to 'lingotek_admin_field_settings_form'
lingotek_admin_configuration_view in ./lingotek.admin.inc

File

./lingotek.admin.inc, line 2306

Code

function lingotek_admin_field_settings_form($form, &$form_state) {
  $field_types = field_info_field_types();
  $fields = field_info_fields();
  $enabled_types = lingotek_get_translatable_field_types();
  $all_column_names = lingotek_get_all_column_names($fields);
  $enabled_column_names = lingotek_get_translatable_field_columns();
  $form['#action'] = url('admin/settings/lingotek/settings', array(
    'fragment' => 'ltk-fields',
  ));
  $form['field_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Field Types and Settings'),
    'actions' => array(
      '#type' => 'actions',
      'submit' => array(
        '#type' => 'submit',
        '#value' => t('Save'),
      ),
    ),
    '#submit' => array(
      'lingotek_admin_field_settings_form_submit',
    ),
  );

  // FIELD TYPES
  $form['field_settings']['field_types'] = array(
    '#type' => 'fieldset',
    '#title' => t('Field Types'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  foreach ($field_types as $type_name => $type_info) {
    $form['field_settings']['field_types']['fld__' . $type_name] = array(
      '#type' => 'checkbox',
      '#title' => filter_xss($type_info['label']),
      '#default_value' => in_array($type_name, $enabled_types),
    );
  }

  // FIELD COLUMN DEFAULTS
  $form['field_settings']['field_column_defaults'] = array(
    '#type' => 'fieldset',
    '#title' => t('Field Column Defaults'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  foreach ($all_column_names as $column_name => $fields) {
    $column_title_message = $column_name . ' (' . implode(', ', $fields) . ')';
    $form['field_settings']['field_column_defaults']['col__' . $column_name] = array(
      '#type' => 'checkbox',
      '#title' => filter_xss($column_title_message),
      '#default_value' => in_array($column_name, $enabled_column_names),
    );
  }
  return $form;
}