You are here

function _shortener_url_settings in Shorten URLs 7

Same name and namespace in other branches
  1. 6 shortener/shortener.module \_shortener_url_settings()
  2. 7.2 shortener/shortener.module \_shortener_url_settings()

Builds the settings form for the input filter.

1 string reference to '_shortener_url_settings'
shortener_filter_info in shortener/shortener.module
Implements hook_filter_info().

File

shortener/shortener.module, line 107
Provides an input filter that replaces URLs with a shortened version.

Code

function _shortener_url_settings($orig_form, &$form_state, $filter, $format, $defaults, $filters) {
  $filter->settings += $defaults;
  $form = array();
  $form['shortener_url_behavior'] = array(
    '#type' => 'radios',
    '#title' => t('Behavior'),
    '#default_value' => $filter->settings['shortener_url_behavior'],
    '#options' => array(
      'short' => t('Display the shortened URL by default, and add an "(expand)"/"(shorten)" link'),
      'strict' => t('Display the shortened URL by default, and do not allow expanding it'),
      'long' => t('Display the full URL by default, and add a "(shorten)"/"(expand)" link'),
    ),
  );
  $form['shortener_url_length'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum link text length'),
    '#default_value' => $filter->settings['shortener_url_length'],
    '#maxlength' => 4,
    '#description' => t('URLs longer than this number of characters will be truncated to prevent long strings that break formatting. The link itself will be retained; just the text portion of the link will be truncated.'),
  );
  return $form;
}