You are here

function url_field_formatter_settings_form in URL field 7

Same name and namespace in other branches
  1. 8 url.module \url_field_formatter_settings_form()

Implements hook_field_formatter_settings_form().

File

./url.module, line 248
Provides a URL field type that stores external links with optional titles.

Code

function url_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element['trim_length'] = array(
    '#type' => 'textfield',
    '#title' => t('Trim the link text to certain number of characters'),
    '#description' => t('To leave long link text alone, leave this blank.'),
    '#default_value' => $settings['trim_length'],
    '#size' => 10,
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
  );
  $element['nofollow'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add rel="nofollow" to all links'),
    '#default_value' => $settings['nofollow'],
  );
  return $element;
}