function mvf_field_formatter_settings_summary in Measured Value Field 7
Implements hook_field_formatter_settings_summary().
File
- ./
mvf.module, line 882 - Define a field type of measured value.
Code
function mvf_field_formatter_settings_summary($field, $instance, $view_mode) {
$summary = array();
$superior_formatter = $instance['display'][$view_mode];
foreach ($field['settings']['meta_info'] as $subfield => $meta_info) {
if ($superior_formatter['type'] == 'mvf_formatter_symbol' && $subfield == 'unit') {
// For symbol formatter for unit sub field we do not have to outsource the
// task of generation of summary to the sub formatter.
$subsummary = 'Units as symbol';
}
else {
// We collect what subformatter wants to output into the summary for the
// the sub field.
$mocked_field = mvf_field_mockup($field, $subfield);
$mocked_instance = mvf_instance_mockup($field, $instance, $subfield);
$formatter = $mocked_instance['display'][$view_mode];
$subsummary = module_invoke($formatter['module'], 'field_formatter_settings_summary', $mocked_field, $mocked_instance, $view_mode);
}
if ($subsummary) {
$summary[$subfield] = $subsummary;
}
}
$summary = implode('; ', $summary);
if (empty($summary)) {
// We have to output at least some string in order to make the "settings"
// button for format appear.
$summary = 'no format';
}
return $summary;
}