You are here

function hansel_ui_settings in Hansel breadcrumbs 8

Same name and namespace in other branches
  1. 7 hansel_ui/hansel_ui.module \hansel_ui_settings()

Page callback.

Generates the settings page for Hansel.

1 string reference to 'hansel_ui_settings'
_hansel_ui_menu in hansel_ui/hansel_ui.registry.inc
Registry function for hook_menu().

File

hansel_ui/hansel_ui.module, line 115
Hansel UI module

Code

function hansel_ui_settings($form_state) {
  $form = array();
  $form['hansel_breadcrumb_last_item_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Render last item as a link'),
    '#default_value' => variable_get('hansel_breadcrumb_last_item_link', TRUE),
    '#description' => t('When turned on, the last item in the breadcrumb will be a link.'),
  );
  $form['hansel_breadcrumb_last_item_hide'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide last item'),
    '#default_value' => variable_get('hansel_breadcrumb_last_item_hide', FALSE),
    '#description' => t('Remove the last item of the breadcrumb.'),
  );
  $form['hansel_max_item_length'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum length for individual items'),
    '#default_value' => variable_get('hansel_max_item_length', 0),
    '#description' => t('Maximum length in characters. Use 0 to disable trimming.'),
    '#size' => 5,
  );
  $form['hansel_trim_on_word_boundary'] = array(
    '#type' => 'checkbox',
    '#title' => t('Trim on word boundary'),
    '#default_value' => variable_get('hansel_trim_on_word_boundary', TRUE),
  );
  $form['hansel_trim_ellipsis'] = array(
    '#type' => 'textfield',
    '#title' => t('Ellipsis'),
    '#default_value' => variable_get('hansel_trim_ellipsis', '...'),
    '#description' => t('Text to add after trimmed texts.'),
  );
  $form['hansel_max_item_count'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum number of items'),
    '#default_value' => variable_get('hansel_max_item_count', 0),
    '#description' => t('Maximum number of breadcrumb items. Items will be removed from the middle. Use 0 to disable.'),
    '#size' => 5,
  );
  $form['hansel_removed_items_replacement'] = array(
    '#type' => 'textfield',
    '#title' => t('Removed items replacement'),
    '#default_value' => variable_get('hansel_removed_items_replacement', '(...)'),
    '#description' => t('Removed breadcrumb items will be replaced by this text.'),
  );
  $form['hansel_remove_first_token_item'] = array(
    '#type' => 'checkbox',
    '#title' => t('Remove first item from Hansel path token'),
    '#default_value' => variable_get('hansel_remove_first_token_item', TRUE),
    '#description' => t('Hansel provides a path token for use in Pathauto. This option removes the first breadcrumb item from this token, which is usually "Home".'),
  );
  $options = array(
    60,
    120,
    300,
    600,
    900,
    1800,
    3600,
    10800,
    21600,
    43200,
    86400,
  );
  $options = array(
    0 => t('Disable'),
  ) + drupal_map_assoc($options, 'format_interval');
  $form['hansel_cache'] = array(
    '#type' => 'select',
    '#title' => t('Cache'),
    '#options' => $options,
    '#default_value' => variable_get('hansel_cache', 0),
    '#description' => t('Only parts which require interaction with the database are cached. Enabling this cache is only recommended when you use an efficient caching system (such as memcache).'),
  );
  $options = array(
    60,
    120,
    300,
    600,
    900,
    1800,
    3600,
    10800,
    21600,
    43200,
    86400,
  );
  $options = array(
    0 => t('Disable'),
  ) + drupal_map_assoc($options, 'format_interval');
  $form['hansel_cache_whole'] = array(
    '#type' => 'select',
    '#title' => t('Cache whole breadcrumbs'),
    '#options' => $options,
    '#default_value' => variable_get('hansel_cache_whole', 0),
    '#description' => t('Only for anonymous visitors.'),
  );
  $form['hansel_set_menu_item'] = array(
    '#type' => 'checkbox',
    '#title' => t('Set active menu item'),
    '#default_value' => variable_get('hansel_set_menu_item', FALSE),
    '#description' => t('Look for a menu item which corresponds the breadcrumbs and set that as the active menu item.'),
  );
  $form['hansel_set_menu_item_skip_first'] = array(
    '#type' => 'checkbox',
    '#title' => t('Skip first crumb'),
    '#default_value' => variable_get('hansel_set_menu_item_skip_first', TRUE),
    '#description' => t('Ignore the first breadcrumb item when searching for a menu item.'),
  );
  $form['hansel_set_menu_name'] = array(
    '#type' => 'checkbox',
    '#title' => t('Set active menu name for current path'),
    '#default_value' => variable_get('hansel_set_menu_name', TRUE),
    '#description' => t('This is required for the \'leave original breadcrumbs\' option to work for pages which are not in the default menu. Turn this option off if you experience side effects.'),
  );
  $form['hansel_parent_lookup_paths'] = array(
    '#type' => 'checkbox',
    '#title' => t('Lookup url aliases when looking for parents'),
    '#default_value' => variable_get('hansel_parent_lookup_paths', TRUE),
    '#description' => t('Hansel is able to lookup parents based on url aliases. But this may cost extra database queries. You should disable this feature when not required.'),
  );
  return system_settings_form($form);
}