function text_field_formatter_settings_form

Implements hook_field_formatter_settings_form().

File

modules/field/modules/text/text.module, line 218

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('Trimmed limit'),
            '#type' => 'textfield',
            '#field_suffix' => t('characters'),
            '#size' => 10,
            '#default_value' => $settings['trim_length'],
            '#element_validate' => array(
                'element_validate_integer_positive',
            ),
            '#description' => t('If the summary is not set, the trimmed %label field will be shorter than this character limit.', array(
                '%label' => $instance['label'],
            )),
            '#required' => TRUE,
        );
    }
    return $element;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.