function name_get_additional_sources in Name Field 7
Helper function to get alternative name component sources.
1 call to name_get_additional_sources()
- _name_field_instance_settings_form in includes/
name.content.inc - Implements hook_field_instance_settings_form().
File
- ./
name.module, line 1457 - Defines an API for displaying and inputing names.
Code
function name_get_additional_sources($instance) {
$sources = array();
$info = entity_get_info();
$sources['_self'] = t('@label label', array(
'@label' => $info[$instance['entity_type']]['label'],
));
if ($instance['entity_type'] == 'user') {
$sources['_self_property_name'] = t('@label login name', array(
'@label' => $info[$instance['entity_type']]['label'],
));
}
foreach (field_info_instances($instance['entity_type'], $instance['bundle']) as $_field_name => $_instance) {
if ($_field_name != $instance['field_name']) {
$sources[$_field_name] = $_instance['label'];
}
}
return $sources;
}