You are here

function taxonomy_image_link_alter_form in Taxonomy Image 6

Same name and namespace in other branches
  1. 5 contributed/taxonomy_image_link_alter/taxonomy_image_link_alter.module \taxonomy_image_link_alter_form()
1 string reference to 'taxonomy_image_link_alter_form'
taxonomy_image_link_alter_menu in contributed/taxonomy_image_link_alter/taxonomy_image_link_alter.module
Implementation of hook_menu.

File

contributed/taxonomy_image_link_alter/taxonomy_image_link_alter.module, line 113
Change taxonomy links to show term images.

Code

function taxonomy_image_link_alter_form() {
  drupal_add_css(drupal_get_path('module', 'taxonomy_image') . '/taxonomy_image.css');
  $form = array();
  $form['taxonomy_image_link_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Select content types to alter links'),
    '#options' => array_map('check_plain', node_get_types('names')),
    '#default_value' => variable_get('taxonomy_image_link_types', array()),
    '#description' => t('For the selected content types, the taxonomy links will use taxonomy images if they are available.'),
    '#prefix' => '<div class="taxonomy_image_checkboxes">',
    '#suffix' => '</div>',
    '#weight' => -3,
  );
  $form['taxonomy_image_link_show_name'] = array(
    '#type' => 'radios',
    '#title' => t('Link style'),
    '#options' => array(
      0 => t('Image only'),
      1 => t('Image and name'),
    ),
    '#default_value' => variable_get('taxonomy_image_link_show_name', 0),
    '#description' => t('For the selected content types, this determines how the taxonomy links will be displayed.'),
    '#prefix' => '<div class="taxonomy_image_radios">',
    '#suffix' => '</div>',
  );
  $sort_options = array(
    0 => 'No sort',
    1 => 'Alphabetically',
    2 => 'By ID',
  );
  $form['taxonomy_image_link_sort_links'] = array(
    '#type' => 'radios',
    '#options' => $sort_options,
    '#title' => t('Sort links'),
    '#default_value' => variable_get('taxonomy_image_link_sort_links', 0),
    '#description' => t('Do you want the links reordered? If selected, vocabulary and term weight will be most important.
      "Alphabetically" will sort the vocabularies and terms by name;
      "By ID" will sort the vocabularies and terms by their IDs.'),
    '#prefix' => '<div class="taxonomy_image_radios">',
    '#suffix' => '</div>',
  );
  if (module_exists('imagecache')) {
    $form['taxonomy_image_link_preset'] = array(
      '#type' => 'radios',
      '#title' => t('Imagecache Preset'),
      '#options' => drupal_map_assoc(_taxonomy_image_presets()),
      '#default_value' => variable_get('taxonomy_image_link_preset', variable_get('taxonomy_image_imagecache_preset', 'ORIGINAL')),
      '#prefix' => '<div class="taxonomy_image_radios">',
      '#suffix' => '</div><div class="clear-block"></div><br />',
    );
  }
  return system_settings_form($form);
}