You are here

function tagclouds_settings in TagCloud 7

Menu callback. Admin setting page for tagclouds.

1 string reference to 'tagclouds_settings'
tagclouds_menu in ./tagclouds.module
Implements hook_menu().

File

./tagclouds.module, line 63

Code

function tagclouds_settings() {
  $options = array(
    'title,asc' => t('by title, ascending'),
    'title,desc' => t('by title, descending'),
    'count,asc' => t('by count, ascending'),
    'count,desc' => t('by count, descending'),
    'random,none' => t('random'),
  );
  $form['tagclouds_sort_order'] = array(
    '#type' => 'radios',
    '#title' => t('Tagclouds sort order'),
    '#options' => $options,
    '#default_value' => variable_get('tagclouds_sort_order', 'title,asc'),
    '#description' => t('Determines the sort order of the tags on the freetagging page.'),
  );
  $options_display = array(
    'style' => t('Display Tags with Style'),
    'count' => t('Display Tags with Count'),
  );
  $form['tagclouds_display_type'] = array(
    '#type' => 'radios',
    '#title' => t('Tagclouds Display Type'),
    '#options' => $options_display,
    '#default_value' => variable_get('tagclouds_display_type', 'style'),
    '#description' => t('Determines the style of the page.'),
  );
  $form['tagclouds_display_node_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Link term to node when only one content is tagged'),
    '#default_value' => variable_get('tagclouds_display_node_link', true),
    '#description' => t('When there is only one content tagged with a certain term, link that term to this node instead of the term list page.'),
  );
  $form['tagclouds_display_more_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display "more" link in the bottom of Tagcloud blocks'),
    '#default_value' => variable_get('tagclouds_display_more_link', TRUE),
    '#description' => t('Display "more" link, if number of existing tags bigger than the number of tags to show.'),
  );
  $form['tagclouds_page_amount'] = array(
    '#type' => 'textfield',
    '#size' => 5,
    '#title' => t('Amount of tags on the pages'),
    '#default_value' => variable_get('tagclouds_page_amount', '60'),
    '#description' => t("The amount of tags that will show up in a cloud on the\n      pages. Enter '0' to display all tags. Amount of tags in blocks must be\n      configured in the block settings of the various cloud blocks."),
  );
  $form['tagclouds_levels'] = array(
    '#type' => 'textfield',
    '#size' => 5,
    '#title' => t('Number of levels'),
    '#default_value' => variable_get('tagclouds_levels', 6),
    '#description' => t('The number of levels between the least popular
      tags and the most popular ones. Different levels will be assigned a different
      class to be themed in tagclouds.css'),
  );
  $lang = language_list('enabled');
  if (!empty($lang) && count($lang[1]) > 1) {

    /* select this option if you want language separation and the site
       is using node translation rather than entity_translation */
    if (!module_exists('entity_translation')) {
      $form['tagclouds_language_separation'] = array(
        '#type' => 'checkbox',
        '#title' => t('Separation of Tags per language for bundles/content types using node translation'),
        '#default_value' => variable_get('tagclouds_language_separation', 0),
        '#description' => t('If you have more than one language installed and your content type/bundle is configured to use node translation (one language per node) then this setting would allow you to separate the tags for each language. '),
      );
    }
    else {

      //entity translation is enabled
      $form['tagclouds_language_separation_radios'] = array(
        '#type' => 'radios',
        '#title' => t('Separation of Tags per language'),
        '#options' => array(
          '0' => t('Disable separation by language'),
          '1' => t('Separation of Tags per language for site configured to use node translation (Choose this if you have one language per node , but no entity/field translations for the node fields and your taxonomy/vocabulary is not entity translation enabled)'),
          'entity' => t('Separation of Tags per language per entity. (Choose this if your content type/bundle is configured to use field translation aka entity translation and your tagcloudable taxonomy/vocabulary is translation enabled each term has a translation)'),
        ),
        '#default_value' => variable_get('tagclouds_language_separation_radios', '0'),
        '#description' => t('*Choose tagclouds language separation method.'),
        '#required' => TRUE,
      );
    }
  }
  return system_settings_form($form);
}