You are here

function tft_settings_form in Taxonomy File Tree 7

Same name and namespace in other branches
  1. 7.2 includes/tft.admin.inc \tft_settings_form()

Taxonomy File Tree settings form

1 string reference to 'tft_settings_form'
tft_menu in ./tft.module
Implementation of hook_menu().

File

./tft.admin.inc, line 6

Code

function tft_settings_form() {
  $taxonomy = taxonomy_get_vocabularies();
  $vocabularies = array();
  $node_types = array();

  // Get all vocabularies
  foreach ($taxonomy as $vid => $voc) {
    $vocabularies[$vid] = $voc->name;
  }
  $result = db_query("SELECT {field_config_instance}.bundle, {field_config_instance}.field_name FROM {field_config_instance}\n                        LEFT JOIN {field_config} ON {field_config}.field_name = {field_config_instance}.field_name\n                      WHERE {field_config}.module = 'file'");

  // Get all node types with a filefield
  while ($row = $result
    ->fetchAssoc()) {
    $node_types[$row['bundle'] . '-' . $row['field_name']] = $row['bundle'] . '->' . $row['field_name'];
  }
  $form['tft_vocabulary_vid'] = array(
    '#type' => 'radios',
    '#title' => t("File tree vocabulary"),
    '#options' => $vocabularies,
    '#required' => TRUE,
    '#default_value' => variable_get('tft_vocabulary_vid', 0),
  );
  $form['tft_content_type'] = array(
    '#type' => 'radios',
    '#title' => t("File node type -> filefield"),
    '#description' => t("Set which node type must act as the 'file' (must contain a filefield)."),
    '#options' => $node_types,
    '#required' => TRUE,
    '#default_value' => variable_get('tft_content_type', 0),
  );
  $form['add_archive_folders'] = array(
    '#type' => 'button',
    '#name' => 'add_archive_folders',
    '#value' => t("Add archive folders to all OG file trees"),
  );
  return system_settings_form($form);
}