function text_field_formatter_settings_form

7.x text.module text_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state)

Implements hook_field_formatter_settings_form().

File

drupal-7.x/modules/field/modules/text/text.module, line 218
Defines simple text field types.

Code

function text_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];

  $element = array();

  if (strpos($display['type'], '_trimmed') !== FALSE) {
    $element['trim_length'] = array(
      '#title' => t('Trim length'),
      '#type' => 'textfield',
      '#size' => 10,
      '#default_value' => $settings['trim_length'],
      '#element_validate' => array('element_validate_integer_positive'),
      '#required' => TRUE,
    );
  }

  return $element;
}