function field_group_field_group_format_summary in Field Group 7
Same name and namespace in other branches
- 7.2 field_group.module \field_group_field_group_format_summary()
Implements hook_field_group_format_summary().
File
- ./
field_group.module, line 1274 - Fieldgroup module.
Code
function field_group_field_group_format_summary($group) {
$group_form = module_invoke_all('field_group_format_settings', $group);
$output = '';
if (isset($group->format_settings['formatter'])) {
$output .= '<strong>' . $group->format_type . '</strong> ' . $group->format_settings['formatter'] . '';
}
if (isset($group->format_settings['instance_settings'])) {
$last = end($group->format_settings['instance_settings']);
$output .= '<br />';
foreach ($group->format_settings['instance_settings'] as $key => $value) {
if (empty($value)) {
continue;
}
$output .= '<strong>' . $key . '</strong> ';
if (isset($group_form['instance_settings'], $group_form['instance_settings'][$key]['#options'])) {
if (is_array($value)) {
$value = implode(array_filter($value), ', ');
}
else {
$value = $group_form['instance_settings'][$key]['#options'][$value];
}
}
// Shorten the string.
if (drupal_strlen($value) > 38) {
$value = truncate_utf8($value, 50, TRUE, TRUE);
}
elseif (is_numeric($value)) {
$value = $value == '1' ? t('yes') : t('no');
}
$output .= check_plain($value);
$output .= $last == $value ? ' ' : '<br />';
}
}
return $output;
}