1 field.module | field_config_label_instance($instance, $config_name) |
Given a field array, display a unique label.
Related topics
File
- core/
modules/ field/ field.module, line 433 - Attach custom data fields to Backdrop entities.
Code
function field_config_label_instance($instance, $config_name) {
list($entity_type_name, $bundle, $field_name) = explode('.', str_replace('field.instance.', '', $config_name));
$entity_type = entity_get_info($entity_type_name);
$entity_label = $entity_type['label'];
$bundle_label = isset($entity_type['bundles'][$bundle]['label']) ? $entity_type['bundles'][$bundle]['label'] : $bundle;
return $entity_label . ' - ' . $bundle_label . ' - ' . $instance['label'];
}