function field_test_field_formatter_settings_summary

Implements hook_field_formatter_settings_summary().

File

modules/field/tests/field_test.field.inc, line 325

Code

function field_test_field_formatter_settings_summary($field, $instance, $view_mode) {
    $display = $instance['display'][$view_mode];
    $settings = $display['settings'];
    $summary = '';
    // The name of the setting depends on the formatter type.
    $map = array(
        'field_test_default' => 'test_formatter_setting',
        'field_test_multiple' => 'test_formatter_setting_multiple',
        'field_test_with_prepare_view' => 'test_formatter_setting_additional',
    );
    if (isset($map[$display['type']])) {
        $name = $map[$display['type']];
        $summary = t('@setting: @value', array(
            '@setting' => $name,
            '@value' => $settings[$name],
        ));
    }
    return $summary;
}

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