1 field.module field_config_label_bundle($bundle_config, $config_name)

Given a bundle config file, display a unique label.

Related topics

File

core/modules/field/field.module, line 443
Attach custom data fields to Backdrop entities.

Code

function field_config_label_bundle($bundle_config, $config_name) {
  list($entity_type_name, $bundle) = explode('.', str_replace('field.bundle.', '', $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;
}