You are here

function taxonomy_list_admin_settings in Taxonomy List 6

Same name and namespace in other branches
  1. 5.2 taxonomy_list.module \taxonomy_list_admin_settings()
  2. 5 taxonomy_list.module \taxonomy_list_admin_settings()
  3. 6.2 taxonomy_list.module \taxonomy_list_admin_settings()
  4. 7 taxonomy_list.admin.inc \taxonomy_list_admin_settings()

Menu callback; presents the admin settings form.

1 string reference to 'taxonomy_list_admin_settings'
taxonomy_list_menu in ./taxonomy_list.module
Implementation of hook_menu().

File

./taxonomy_list.module, line 620
List all terms in a vocabulary.

Code

function taxonomy_list_admin_settings() {
  $form = array();
  $form['taxonomy_list_info'] = array(
    '#value' => t('<p>The taxonomy_list module enable the URL to browse into each vocabulary, using the format of :</p>') . t('<code>"taxonomy/vocabulary/&lt;vid&gt;"</code>') . t('<p>Together with the taxonomy_image.module, the list can be displayed with a image icon.</p>'),
  );

  // General settings.
  $form['general'] = array(
    '#type' => 'fieldset',
    '#title' => t('General settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $sep_opts = array(
    ' & ' => 'ampersand (&amp;)',
    ' | ' => 'vertical bar (pipe)',
    ', ' => 'comma (,)',
    ' &bull; ' => 'bullet',
    ' &#8211; ' => 'en-dash (&#8211;)',
    ' &#8212; ' => 'em-dash (&#8212;)',
    ' _ ' => 'underscore',
  );
  $form['general']['taxonomy_list_title_separator'] = array(
    '#type' => 'radios',
    '#title' => t('Vocabulary separator'),
    '#default_value' => variable_get('taxonomy_list_title_separator', ' & '),
    '#options' => $sep_opts,
    '#description' => t('This is the character that separates multiple vocabulary names in the page title.'),
    '#prefix' => '<div class="taxonomy_list_radios">',
    '#suffix' => '</div>',
  );
  $form['general']['taxonomy_list_list_mode'] = array(
    '#type' => 'radios',
    '#title' => t('List Mode'),
    '#default_value' => variable_get('taxonomy_list_list_mode', 0),
    '#options' => array(
      '0' => t("Hierarchical - Subcategories as a table inside their parent's cell."),
      '1' => t('Flat - All terms are listed as the same level in the grid.'),
    ),
    '#description' => t('How Taxonomy List displays the list of terms.'),
  );
  $form['general']['taxonomy_list_cell_per_row'] = array(
    '#type' => 'textfield',
    '#title' => t('Terms per row'),
    '#size' => 5,
    '#default_value' => variable_get('taxonomy_list_cell_per_row', 2),
    '#description' => t('Number of terms to be displayed on the same row.'),
  );

  // General link settings.
  $form['general']['link'] = array(
    '#type' => 'fieldset',
    '#title' => t('Link options'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['general']['link']['taxonomy_list_edit_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add "edit term" link'),
    '#default_value' => variable_get('taxonomy_list_edit_link', FALSE),
    '#description' => t('Should I add an "edit term" link to the display for authorized users?'),
  );
  if (module_exists('search')) {
    $form['general']['link']['taxonomy_list_search_link'] = array(
      '#type' => 'checkbox',
      '#title' => t('Add "search for term" link'),
      '#default_value' => variable_get('taxonomy_list_search_link', FALSE),
      '#description' => t('Should I add an "search for term" link to the display for authorized users?'),
    );
  }
  $form['general']['link']['taxonomy_list_rss_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add RSS link'),
    '#default_value' => variable_get('taxonomy_list_rss_link', FALSE),
    '#description' => t('Should I add an RSS link (icon) to the display?'),
  );
  $form['general']['link']['taxonomy_list_show_children'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show children when clicked'),
    '#default_value' => variable_get('taxonomy_list_show_children', FALSE),
    '#description' => t('If this is a parent term, show the content for children when the link is clicked upon?'),
  );

  // Optional settings.
  $form['optional'] = array(
    '#type' => 'fieldset',
    '#title' => t('Optional information'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['optional']['taxonomy_list_types'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show content types'),
    '#default_value' => variable_get('taxonomy_list_types', FALSE),
    '#description' => t('Do you want to display a list of the content types for the vocabulary?'),
  );
  $form['optional']['taxonomy_list_related'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show related terms'),
    '#default_value' => variable_get('taxonomy_list_related', FALSE),
    '#description' => t('If there are related terms, should they be listed?'),
  );
  $form['optional']['taxonomy_list_synonyms'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show synonyms for the term'),
    '#default_value' => variable_get('taxonomy_list_synonyms', FALSE),
    '#description' => t('If there are synonyms for the term, should they be listed?'),
  );
  $form['optional']['taxonomy_list_show_parents'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show parents of the term'),
    '#default_value' => variable_get('taxonomy_list_show_parents', FALSE),
    '#description' => t('If this is a child term, show the parent structure?'),
  );

  // Counting settings.
  $form['count'] = array(
    '#type' => 'fieldset',
    '#title' => t('Count content'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $count_opts = array(
    'none' => t('No count.'),
    'all' => t('Count all content types.'),
    'by_type' => t('Count by content type.'),
    'not_zero' => t("Count by type, don't show zero counts."),
  );
  $form['count']['taxonomy_list_count'] = array(
    '#type' => 'radios',
    '#title' => t('Count content types'),
    '#default_value' => variable_get('taxonomy_list_count', 0),
    '#options' => $count_opts,
    '#description' => t('How Taxonomy List counts the content types for terms.'),
    '#prefix' => '<div class="taxonomy_list_radios">',
    '#suffix' => '</div>',
  );
  if (module_exists('node_type_filter')) {
    $form['count']['taxonomy_list_count']['#description'] .= ' ' . t('The "Count by type" options will generate a link to show that type within that term.');
  }
  $form['count']['taxonomy_list_noshow'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide terms with no content'),
    '#default_value' => variable_get('taxonomy_list_noshow', FALSE),
    '#description' => t('Do not show the term if there is no content using the term. Requires one of the counting options above.'),
  );

  // Taxonomy Image settings.
  if (module_exists('taxonomy_image')) {
    $form['taxonomy_image'] = array(
      '#type' => 'fieldset',
      '#title' => t('Taxonomy Image'),
      '#description' => t('The taxonomy Image module is available.'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['taxonomy_image']['taxonomy_list_show_image'] = array(
      '#type' => 'checkbox',
      '#title' => t('Show taxonomy image?'),
      '#default_value' => variable_get('taxonomy_list_show_image', 1),
      '#description' => t('Display the taxonomy image?'),
    );
    if (variable_get('taxonomy_image_wrapper', FALSE)) {
      $form['taxonomy_image']['taxonomy_list_show_image']['#description'] .= ' ' . t('Note that Taxonomy Image already provides a wrapper &lt;div&gt;, which may be styled individually.');
    }
    $img_link_opts = array(
      'term' => t('Term path (e.g. taxonomy/term/xxx).'),
      'big' => t('Full size image.'),
    );
    $form['taxonomy_image']['taxonomy_list_image_link'] = array(
      '#type' => 'radios',
      '#options' => $img_link_opts,
      '#title' => t('Show taxonomy image'),
      '#default_value' => variable_get('taxonomy_list_image_link', 'term'),
      '#description' => t('This option determines what happens if the user clicks on the image.'),
      '#prefix' => '<div class="taxonomy_list_radios">',
      '#suffix' => '</div>',
    );
  }
  return system_settings_form($form);
}