function hook_party_primary_fields_sources_alter in Party 7
Alter the primary field sources.
For example you can change the label of a source or add information for conversion callbacks. Callbacks can be used to convert other sources into the required value or type.
Sources should not be added here as EntityMetadataWrappers are used to retrieve values. See hook_entity_property_info() for details of how to add or expose properties.
Parameters
array $sources: The sources. See the return of PartyPrimaryFields::$sources for the data structure.
See also
PartyPrimaryFields::$sources()
2 functions implement hook_party_primary_fields_sources_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- party_party_primary_fields_sources_alter in ./
party.party_info.inc - Implements hook_party_primary_fields_sources_alter().
- party_user_party_primary_fields_sources_alter in modules/
party_user/ party_user.party_info.inc - Implements hook_party_primary_fields_sources_alter().
1 invocation of hook_party_primary_fields_sources_alter()
- PartyPrimaryFields::buildSources in includes/
party.primary_fields.inc - Build the primary field source information.
File
- ./
party.api.php, line 519 - Hooks provided by the Party module.
Code
function hook_party_primary_fields_sources_alter(&$sources) {
// Allow uid to be converted to a username.
if (isset($sources['user']['sources']['user:uid'])) {
$sources['user']['sources']['user:uid']['callbacks']['uid_to_username'] = array(
'label' => t('Formatted username'),
'callback' => 'party_user_primary_fields_callback_uid_to_format_username',
);
}
}