function entityreference_field_formatter_settings_summary in Entity reference 7
Implements hook_field_formatter_settings_summary().
File
- ./
entityreference.module, line 1258 - Entityreference primary module file.
Code
function entityreference_field_formatter_settings_summary($field, $instance, $view_mode) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$field_type_settings = entityreference_field_type_settings($field);
$summary = array();
if ($display['type'] == 'entityreference_label') {
$summary[] = $settings['link'] ? t('Link to the referenced entity') : t('No link');
$summary[] = $settings['bypass_access'] ? t('Show labels regardless of access') : t('Respect entity access for label visibility');
}
if ($display['type'] == 'entityreference_entity_view') {
$entity_info = entity_get_info($field_type_settings['entity_type']);
$view_mode_label = $settings['view_mode'] == 'default' ? t('Default') : $settings['view_mode'];
if (isset($entity_info['view modes'][$settings['view_mode']]['label'])) {
$view_mode_label = $entity_info['view modes'][$settings['view_mode']]['label'];
}
$summary[] = t('Rendered as @mode', array(
'@mode' => $view_mode_label,
));
$summary[] = !empty($settings['links']) ? t('Display links') : t('Do not display links');
$summary[] = !empty($settings['use_content_language']) ? t('Use current content language') : t('Use field language');
$summary[] = !empty($settings['hide_title']) ? t('Hide Title') : t('Show Title');
}
return implode('<br />', $summary);
}