You are here

function party_primary_fields_callback_party_name_field_label in Party 7

Primary field callback for converting a Name field to a label.

See also

party_party_primary_fields_sources_alter()

1 string reference to 'party_primary_fields_callback_party_name_field_label'
party_party_primary_fields_sources_alter in ./party.party_info.inc
Implements hook_party_primary_fields_sources_alter().

File

./party.party.inc, line 172
Party general hook include.

Code

function party_primary_fields_callback_party_name_field_label($value, $target, $target_info, $source_info) {
  if (isset($value)) {

    // Get hold of the name format.
    $data_set = party_get_data_set_info($source_info['data_set']);
    $instance = field_info_instance($data_set['entity type'], $source_info['property'], $data_set['entity bundle']);
    $format = name_get_format_by_machine_name($instance['settings']['override_format']);
    if (empty($format)) {
      $format = name_get_format_by_machine_name('default');
    }
    return name_format($value, $format);
  }
}