You are here

function party_party_primary_fields_sources_alter in Party 7

Implements hook_party_primary_fields_sources_alter().

File

./party.party_info.inc, line 88
Party info hook include.

Code

function party_party_primary_fields_sources_alter(&$sources) {

  // Allow pid to be converted to 'Party {pid}'.
  if (isset($sources['party']['sources']['party:pid'])) {
    $sources['party']['sources']['party:pid']['callbacks']['party_label_default'] = array(
      'label' => t('Party default label'),
      'callback' => 'party_primary_fields_callback_party_label_default',
      'type' => 'text',
      'file' => array(
        'type' => 'inc',
        'module' => 'party',
        'name' => 'party.party',
      ),
    );
  }

  // Find any name fields.
  foreach ($sources as &$data_set) {
    foreach ($data_set['sources'] as &$source_info) {
      if ($source_info['field_type'] == 'name') {
        $source_info['callbacks']['party_name_field_label'] = array(
          'label' => t('Convert Name Field to Label'),
          'callback' => 'party_primary_fields_callback_party_name_field_label',
          'type' => 'text',
          'file' => array(
            'type' => 'inc',
            'module' => 'party',
            'name' => 'party.party',
          ),
        );
      }
    }
  }
}